This file contains 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 | |
/** | |
* | |
* This file is part of Atlas for PHP. | |
* | |
* @license http://opensource.org/licenses/mit-license.php MIT | |
* | |
*/ | |
declare(strict_types=1); |
This file contains 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
// given that you have created UserMapper and AddressMapper, | |
// and set up a 1:1 relationship from UserMapper to AddressMapper named 'address': | |
$atlas | |
->select(UserMapper::CLASS) // "FROM user" | |
->joinWith('address') // the name of the relationship field | |
->cols([ | |
'user.id AS id', | |
'user.name AS name', | |
'address.id AS address_id', // aliased using the relationship field name |
This file contains 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 DiscussionRepository | |
{ | |
public function __construct(DiscussionMapper $mapper) {...} | |
public function fetchDiscussion($id) | |
{ | |
$record = $this->mapper->select(['discussion_id' => $id]) | |
->with(['author']); | |
return $this->newDiscussion($record); |
This file contains 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
$ composer require radar/adr 1.x | |
$ rm -rf vendor/composer/ vendor/container-interop/ vendor/psr/ | |
$ phploc --names-exclude="*Test.php" . | |
phploc 3.0.1 by Sebastian Bergmann. | |
Directories 31 | |
Files 121 | |
Size | |
Lines of Code (LOC) 9390 |
This file contains 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
$ composer create-project aura/web-project | |
$ cd web-project | |
$ rm -rf vendor/composer/ vendor/monolog/ vendor/psr/ | |
$ phploc --names-exclude="*Test.php" . | |
phploc 3.0.1 by Sebastian Bergmann. | |
Directories 29 | |
Files 131 | |
Size |
This file contains 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
Per convo at <https://medium.com/@taylorotwell/measuring-code-complexity-64356da605f9> and <https://www.reddit.com/r/PHP/comments/5mycc5/framework_code_complexity_comparison/>. | |
Ran `phploc` against different branches of <https://github.com/laravel/framework/tree/5.4/src/Illuminate>. | |
# Size | |
## 4.0 | |
Directories 90 | |
Files 430 |
This file contains 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
24118 vendors have 1 packages. | |
7316 vendors have 2 packages. | |
3496 vendors have 3 packages. | |
1987 vendors have 4 packages. | |
1259 vendors have 5 packages. | |
889 vendors have 6 packages. | |
654 vendors have 7 packages. | |
492 vendors have 8 packages. | |
405 vendors have 9 packages. | |
307 vendors have 10 packages. |
This file contains 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 | |
// add to the end of FactoryTest | |
public function testSetterCallable() | |
{ | |
$this->factory->setter['Aura\Di\FakeChildClass']['setFake'] = function () { | |
return 'OOPS'; | |
}; | |
$object = $this->factory->newInstance('Aura\Di\FakeChildClass'); | |
$actual = $object->getFake(); |
This file contains 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 | |
$di = $app->getContainer(); | |
// ----------------------------------------------------------------------------- | |
// Service providers | |
// ----------------------------------------------------------------------------- | |
// Twig | |
$di->set('view', function () use ($di) { | |
$settings = $di->get('settings'); |
This file contains 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 BlogFilter | |
{ | |
protected $messages = array(); | |
public function forUpdate(BlogPost $post) | |
{ | |
$this->messages = array(); | |
if (! trim($post->title)) { |
NewerOlder