Skip to content

Instantly share code, notes, and snippets.

Paul M. Jones pmjones

Block or report user

Report or block pmjones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1b9fa880945addabdc84752831864e82
<?php
/**
*
* This file is part of Atlas for PHP.
*
* @license http://opensource.org/licenses/mit-license.php MIT
*
*/
declare(strict_types=1);
View gist:b17e41e86f8e2e01fbfd1eb56d4533b7
// 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
View gist:a06e415b14fb5bf86eedaef73311bfd7
<?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);
View gist:8df962c285a127fd26dc7a3aa88082a6
$ 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
View gist:12c6e54d9941c162bedfe57d346ef43e
$ 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
View gist:20109b503a4636fc58046382e7dece75
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
@pmjones
pmjones / gist:6eb6a4f108aac0ea7456a6cbc576fbb1
Created Dec 26, 2016
vendor/package counts from packagist
View gist:6eb6a4f108aac0ea7456a6cbc576fbb1
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.
View gist:1e50bcefa227792f1297e17a5523282a
<?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();
View dependencies.php
<?php
$di = $app->getContainer();
// -----------------------------------------------------------------------------
// Service providers
// -----------------------------------------------------------------------------
// Twig
$di->set('view', function () use ($di) {
$settings = $di->get('settings');
View gist:5356d2550eb33208f146
<?php
class BlogFilter
{
protected $messages = array();
public function forUpdate(BlogPost $post)
{
$this->messages = array();
if (! trim($post->title)) {
You can’t perform that action at this time.