Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
lsv committed May 24, 2018
1 parent 863afcb commit 080d746
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 42 deletions.
68 changes: 34 additions & 34 deletions src/Model/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public function getOrd1x2Odds(): array
{
$providers = [];

$doOdds = function(Odds $odds, $key) use (&$providers) {
$doOdds = function (Odds $odds, $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
if (! isset($providers[$offer->getProvider()->getId()])) {
if (!isset($providers[$offer->getProvider()->getId()])) {
$providers[$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -241,9 +241,9 @@ public function get1H1x2Odds(): array
{
$providers = [];

$doOdds = function(Odds $odds, $key) use (&$providers) {
$doOdds = function (Odds $odds, $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
if (! isset($providers[$offer->getProvider()->getId()])) {
if (!isset($providers[$offer->getProvider()->getId()])) {
$providers[$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -380,25 +380,25 @@ public function getOrdOverUnderAll(float $notGoals = null): array
$under = $this->getOrdUnderGoals();
if ($notGoals) {
/** @var Odds[] $over */
$over = array_filter($over, function(Odds $odds) use ($notGoals) {
$over = array_filter($over, function (Odds $odds) use ($notGoals) {
return $odds->getDparam1() !== $notGoals;
});

/** @var Odds[] $under */
$under = array_filter($under, function(Odds $odds) use ($notGoals) {
$under = array_filter($under, function (Odds $odds) use ($notGoals) {
return $odds->getDparam1() !== $notGoals;
});
}

$calculateProviders = function(Odds $odds, string $key) use (&$providers) {
$calculateProviders = function (Odds $odds, string $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
$goalKey = 'goals' . $odds->getDparam1();

if (! isset($providers[$goalKey]['goals'])) {
if (!isset($providers[$goalKey]['goals'])) {
$providers[$goalKey]['goals'] = $odds->getDparam1();
}

if (! isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
if (!isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
$providers[$goalKey]['providers'][$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -435,31 +435,31 @@ public function getOrdOverUnderAll(float $notGoals = null): array
/**
* @param float $numberGoals
*
* @return OverUnderGoalsOdds
* @return OverUnderGoalsOdds|null
*/
public function getOrdOverUnderGoals(float $numberGoals): OverUnderGoalsOdds
public function getOrdOverUnderGoals(float $numberGoals): ?OverUnderGoalsOdds
{
/** @var Odds[] $over */
$over = array_filter($this->getOrdOverGoals(), function(Odds $odds) use ($numberGoals) {
$over = array_filter($this->getOrdOverGoals(), function (Odds $odds) use ($numberGoals) {
return $odds->getDparam1() === $numberGoals;
});

/** @var Odds[] $under */
$under = array_filter($this->getOrdUnderGoals(), function(Odds $odds) use ($numberGoals) {
$under = array_filter($this->getOrdUnderGoals(), function (Odds $odds) use ($numberGoals) {
return $odds->getDparam1() === $numberGoals;
});

$providers = [];

$calculateProviders = function(Odds $odds, string $key) use (&$providers) {
$calculateProviders = function (Odds $odds, string $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
$goalKey = 'goals' . $odds->getDparam1();

if (! isset($providers[$goalKey]['goals'])) {
if (!isset($providers[$goalKey]['goals'])) {
$providers[$goalKey]['goals'] = $odds->getDparam1();
}

if (! isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
if (!isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
$providers[$goalKey]['providers'][$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -545,25 +545,25 @@ public function get1HOverUnderAll(float $notGoals = null): array
$under = $this->get1HUnderGoals();
if ($notGoals) {
/** @var Odds[] $over */
$over = array_filter($over, function(Odds $odds) use ($notGoals) {
$over = array_filter($over, function (Odds $odds) use ($notGoals) {
return $odds->getDparam1() !== $notGoals;
});

/** @var Odds[] $under */
$under = array_filter($under, function(Odds $odds) use ($notGoals) {
$under = array_filter($under, function (Odds $odds) use ($notGoals) {
return $odds->getDparam1() !== $notGoals;
});
}

$calculateProviders = function(Odds $odds, string $key) use (&$providers) {
$calculateProviders = function (Odds $odds, string $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
$goalKey = 'goals' . $odds->getDparam1();

if (! isset($providers[$goalKey]['goals'])) {
if (!isset($providers[$goalKey]['goals'])) {
$providers[$goalKey]['goals'] = $odds->getDparam1();
}

if (! isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
if (!isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
$providers[$goalKey]['providers'][$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -596,31 +596,31 @@ public function get1HOverUnderAll(float $notGoals = null): array
/**
* @param float $numberGoals
*
* @return OverUnderGoalsOdds
* @return OverUnderGoalsOdds|null
*/
public function get1HOverUnderGoals(float $numberGoals): OverUnderGoalsOdds
public function get1HOverUnderGoals(float $numberGoals): ?OverUnderGoalsOdds
{
/** @var Odds[] $over */
$over = array_filter($this->get1HOverGoals(), function(Odds $odds) use ($numberGoals) {
$over = array_filter($this->get1HOverGoals(), function (Odds $odds) use ($numberGoals) {
return $odds->getDparam1() === $numberGoals;
});

/** @var Odds[] $under */
$under = array_filter($this->get1HUnderGoals(), function(Odds $odds) use ($numberGoals) {
$under = array_filter($this->get1HUnderGoals(), function (Odds $odds) use ($numberGoals) {
return $odds->getDparam1() === $numberGoals;
});

$providers = [];

$calculateProviders = function(Odds $odds, string $key) use (&$providers) {
$calculateProviders = function (Odds $odds, string $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
$goalKey = 'goals' . $odds->getDparam1();

if (! isset($providers[$goalKey]['goals'])) {
if (!isset($providers[$goalKey]['goals'])) {
$providers[$goalKey]['goals'] = $odds->getDparam1();
}

if (! isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
if (!isset($providers[$goalKey]['providers'][$offer->getProvider()->getId()])) {
$providers[$goalKey]['providers'][$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -739,16 +739,16 @@ public function getOrd1x2OddsHandicap(): array
{
$providers = [];

$doOdds = function(Handicap $handicap, $key) use (&$providers) {
if (! isset($providers[$handicap->getHandicap()])) {
$doOdds = function (Handicap $handicap, $key) use (&$providers) {
if (!isset($providers[$handicap->getHandicap()])) {
$providers[$handicap->getHandicap()] = [
'handicap' => $handicap,
'odds' => []
];
}

foreach ($handicap->getOffers() as $offer) {
if (! isset($providers[$handicap->getHandicap()]['odds'][$offer->getProvider()->getId()])) {
if (!isset($providers[$handicap->getHandicap()]['odds'][$offer->getProvider()->getId()])) {
$providers[$handicap->getHandicap()]['odds'][$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down Expand Up @@ -830,7 +830,7 @@ public function getOrd1x2DrawHandicap(): array
$handicaps[] = new Handicap($this, $team, $filter->getDparam1(), $filter->getOffers());
}

usort($handicaps, function(Handicap $a, Handicap $b) {
usort($handicaps, function (Handicap $a, Handicap $b) {
return $a->getHandicap() <=> $b->getHandicap();
});

Expand Down Expand Up @@ -865,9 +865,9 @@ public function getOrd1x2AwayTeamOddsHandicap(): array
public function getOrdDC(): array
{
$providers = [];
$setOffer = function(Odds $odds, $key) use (&$providers) {
$setOffer = function (Odds $odds, $key) use (&$providers) {
foreach ($odds->getOffers() as $offer) {
if (! isset($providers[$offer->getProvider()->getId()])) {
if (!isset($providers[$offer->getProvider()->getId()])) {
$providers[$offer->getProvider()->getId()] = [
'provider' => $offer->getProvider(),
];
Expand Down
2 changes: 0 additions & 2 deletions src/Model/Odds/MatchWinnerHandicapOdds.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class MatchWinnerHandicapOdds
{

/**
* @var Handicap
*/
Expand Down Expand Up @@ -37,5 +36,4 @@ public function getWinnerOdds(): array
{
return $this->winnerOdds;
}

}
2 changes: 0 additions & 2 deletions src/Model/Odds/MatchWinnerOdds.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class MatchWinnerOdds
{

/**
* @var Provider
*/
Expand Down Expand Up @@ -58,5 +57,4 @@ public function getAwayOffer(): ?Offer
{
return $this->awayOffer;
}

}
2 changes: 0 additions & 2 deletions src/Model/Odds/OverUnderGoalsOdds.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class OverUnderGoalsOdds
{

/**
* @var float
*/
Expand Down Expand Up @@ -40,5 +39,4 @@ public function getOdds(): array
{
return $this->odds;
}

}
2 changes: 0 additions & 2 deletions src/Model/Odds/OverUnderOdds.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class OverUnderOdds
{

/**
* @var Provider
*/
Expand Down Expand Up @@ -50,5 +49,4 @@ public function getUnder(): ?Offer
{
return $this->under;
}

}

0 comments on commit 080d746

Please sign in to comment.