Skip to content

Commit

Permalink
Fixed bug in boot command bus
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Nov 16, 2019
1 parent 45e03ec commit b94721b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
35 changes: 17 additions & 18 deletions src/RESTServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,23 @@ protected function bootCommandBus(Estimator $estimator) : CommandBus
{
$commands = [];

switch (true) {
case $estimator instanceof Estimator:
$commands[QueryModel::class] = new QueryModelHandler($estimator);
$commands[Predict::class] = new PredictHandler($estimator);

// no break
case $estimator instanceof Learner:
$commands[PredictSample::class] = new PredictSampleHandler($estimator);

// no break
case $estimator instanceof Probabilistic:
$commands[Proba::class] = new ProbaHandler($estimator);
$commands[ProbaSample::class] = new ProbaSampleHandler($estimator);

// no break
case $estimator instanceof Ranking:
$commands[Rank::class] = new RankHandler($estimator);
$commands[RankSample::class] = new RankSampleHandler($estimator);
if ($estimator instanceof Estimator) {
$commands[QueryModel::class] = new QueryModelHandler($estimator);
$commands[Predict::class] = new PredictHandler($estimator);
}

if ($estimator instanceof Learner) {
$commands[PredictSample::class] = new PredictSampleHandler($estimator);
}

if ($estimator instanceof Probabilistic) {
$commands[Proba::class] = new ProbaHandler($estimator);
$commands[ProbaSample::class] = new ProbaSampleHandler($estimator);
}

if ($estimator instanceof Ranking) {
$commands[Rank::class] = new RankHandler($estimator);
$commands[RankSample::class] = new RankSampleHandler($estimator);
}

if ($this instanceof Verbose) {
Expand Down
35 changes: 17 additions & 18 deletions src/RPCServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,23 @@ protected function bootCommandBus(Estimator $estimator) : CommandBus
{
$commands = [];

switch (true) {
case $estimator instanceof Estimator:
$commands[QueryModel::class] = new QueryModelHandler($estimator);
$commands[Predict::class] = new PredictHandler($estimator);

// no break
case $estimator instanceof Learner:
$commands[PredictSample::class] = new PredictSampleHandler($estimator);

// no break
case $estimator instanceof Probabilistic:
$commands[Proba::class] = new ProbaHandler($estimator);
$commands[ProbaSample::class] = new ProbaSampleHandler($estimator);

// no break
case $estimator instanceof Ranking:
$commands[Rank::class] = new RankHandler($estimator);
$commands[RankSample::class] = new RankSampleHandler($estimator);
if ($estimator instanceof Estimator) {
$commands[QueryModel::class] = new QueryModelHandler($estimator);
$commands[Predict::class] = new PredictHandler($estimator);
}

if ($estimator instanceof Learner) {
$commands[PredictSample::class] = new PredictSampleHandler($estimator);
}

if ($estimator instanceof Probabilistic) {
$commands[Proba::class] = new ProbaHandler($estimator);
$commands[ProbaSample::class] = new ProbaSampleHandler($estimator);
}

if ($estimator instanceof Ranking) {
$commands[Rank::class] = new RankHandler($estimator);
$commands[RankSample::class] = new RankSampleHandler($estimator);
}

if ($this instanceof Verbose) {
Expand Down

0 comments on commit b94721b

Please sign in to comment.