This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public function calculateExpectedValueAt(DateTimeInterface $date) | |
| { | |
| $diffInDays = (int) $this->startedAt->diff($date)->format('%a'); | |
| $multiplier = $this->initialValue < $this->targetValue ? 1 : -1; | |
| $initialAveragePerDay = $this->calculateInitialAveragePerDay(); | |
| - return $this->initialValue + ($initialAveragePerDay * $diffInDays * $multiplier); | |
| + return $this->initialValue + ($initialAveragePerDay * $diffInDays / $multiplier); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class UserFilterAge | |
| { | |
| const AGE_THRESHOLD = 18; | |
| public function __invoke(array $collection) | |
| { | |
| - return array_filter( | |
| + array_filter( | |
| $collection, | |
| function (array $item) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** | |
| * @dataProvider usersProvider | |
| */ | |
| public function test_it_filters_adults(array $users, int $expectedCount) | |
| { | |
| $filter = new UserFilterAge(); | |
| $this->assertCount($expectedCount, $filter($users)); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| public function test_it_filters_adults() | |
| { | |
| $filter = new UserFilterAge(); | |
| $users = [ | |
| ['age' => 20], | |
| ['age' => 15], | |
| ]; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | - $c = $a + b; | |
| + $c = $a - b; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class UserFilterAge | |
| { | |
| const AGE_THRESHOLD = 18; | |
| public function __invoke(array $collection) | |
| { | |
| return array_filter( | |
| $collection, | |
| function (array $item) { | |
| - return $item['age'] >= self::AGE_THRESHOLD; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| class UserFilterAge | |
| { | |
| const AGE_THRESHOLD = 18; | |
| public function __invoke(array $collection) | |
| { | |
| return array_filter( | |
| $collection, | |
| function (array $item) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | - public function __invoke(array $collection) | |
| + public function __invoke(array $collection): array | 
NewerOlder