Created
December 2, 2016 18:54
-
-
Save alexbowers/de7fdccf4ae3c1c1ce03d909313ae47c to your computer and use it in GitHub Desktop.
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 Collection implements Castable | |
{ | |
protected $items = []; | |
public function __construct(array $items = []) | |
{ | |
$this->items = $items; | |
} | |
// ... | |
} | |
class AnotherClass | |
{ | |
public static function DoSomething(Collection $collection) | |
{ | |
// ... | |
return $collection->sum(); | |
} | |
} | |
// Acceptable Parameters: Collection | array | |
$another = AnotherClass::DoSomething([1,2,3]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment