Last active
February 19, 2019 20:53
-
-
Save nyamsprod/ea48122e8082e480fd7cddbf4714cd3e to your computer and use it in GitHub Desktop.
great vs awesome
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 | |
namespace Sunday\Dev | |
use Foobar\Great; | |
final class Awesome | |
{ | |
public const AWESOME_NUMBER = 99; | |
private $great; | |
public function __construct(Great $great) | |
{ | |
$this->great = $great; | |
} | |
public function do($magic): int | |
{ | |
return $this->great->do($magic); | |
} | |
public function doMore($magic): int | |
{ | |
return $this->great->do($magic) - self::AWESOME_NUMBER; | |
} | |
} |
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 | |
namespace Sunday\Dev | |
use Foobar\Great; | |
class Awesome extends Great | |
{ | |
public const MAGIC_NUMBER = 99; | |
protected const AWESOME_NUMBER = 30; | |
public function doMore($magic): int | |
{ | |
return $this->doMoreInternalMagic($magic); | |
} | |
protected function doMoreInternalMagic($var): int | |
{ | |
return $this->internalMagic($var) - static::AWESOME_NUMBER; | |
} | |
} |
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 | |
namespace Foobar; | |
final class Great | |
{ | |
public const MAGIC_NUMBER = 42; | |
public function do($magic): int | |
{ | |
return $this->internalMagic($magic); | |
} | |
private function internalMagic($var): int | |
{ | |
return self::MAGIC_NUMBER; | |
} | |
} |
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 | |
namespace Foobar; | |
class Great | |
{ | |
public const MAGIC_NUMBER = 42; | |
public function do($magic): int | |
{ | |
return $this->internalMagic($magic); | |
} | |
protected function internalMagic($var): int | |
{ | |
return static::MAGIC_NUMBER; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment