Skip to content

Commit c4e8167

Browse files
committed
PSR-4 + Backport changes from oauth2-php.
1 parent 7dcdb91 commit c4e8167

File tree

115 files changed

+263
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+263
-277
lines changed

.php-cs-fixer.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

3-
return Symfony\CS\Config\Config::create()->finder(Symfony\CS\Finder\DefaultFinder::create()
3+
$fixers = array(
4+
'-psr0',
5+
'-no_empty_lines_after_phpdocs',
6+
);
7+
8+
$finder = Symfony\CS\Finder\DefaultFinder::create()
49
->exclude('app/cache')
510
->exclude('app/log')
611
->exclude('build')
@@ -10,5 +15,10 @@
1015
->notName('LICENSE')
1116
->notName('README.md')
1217
->notName('composer.*')
13-
->notName('phpunit.xml*')
14-
);
18+
->notName('phpunit.xml*');
19+
20+
return Symfony\CS\Config\Config::create()
21+
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
22+
->setUsingCache(false)
23+
->fixers($fixers)
24+
->finder($finder);

.sami.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
->addFromTags('*');
1717

1818
return new Sami($iterator, array(
19-
'theme' => 'enhanced',
19+
'theme' => 'default',
2020
'versions' => $versions,
2121
'title' => 'AuthBucket\Push API',
2222
'build_dir' => __DIR__ . '/build/sami/%version%',

.travis.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
64
- 5.5
5+
- 5.6
6+
- 7.0
77
- hhvm
88

9+
before_install:
10+
- composer self-update
11+
12+
install:
13+
- composer install --prefer-source
14+
915
before_script:
10-
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
11-
- composer install --dev --prefer-source
16+
- mkdir -p build/logs
17+
- rm -rf app/cache/*/*
1218

1319
script:
14-
- vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover ./build/logs/clover.xml
20+
- composer phpunit
1521

1622
after_script:
17-
- php vendor/bin/coveralls -v
23+
- composer coveralls
1824

1925
matrix:
2026
allow_failures:
27+
- php: 7.0
2128
- php: hhvm

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Wong Hoi Sing Edison
3+
Copyright (c) 2015 Wong Hoi Sing Edison
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

app/.htaccess

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<IfModule mod_authz_core.c>
2+
Require all denied
3+
</IfModule>
4+
<IfModule !mod_authz_core.c>
5+
Order deny,allow
6+
Deny from all
7+
</IfModule>

app/autoload.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use Doctrine\Common\Annotations\AnnotationRegistry;
4+
use Composer\Autoload\ClassLoader;
5+
6+
/*
7+
* @var ClassLoader
8+
*/
9+
$loader = require __DIR__.'/../vendor/autoload.php';
10+
11+
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
12+
13+
return $loader;

app/bootstrap.php

+1-49
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,3 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
12-
use Doctrine\Common\Annotations\AnnotationRegistry;
13-
14-
$loader = require __DIR__.'/../vendor/autoload.php';
15-
16-
// See http://symfony.com/doc/current/cookbook/testing/bootstrap.html
17-
if (isset($_ENV['BOOTSTRAP_ENV'])) {
18-
passthru(sprintf(
19-
'php "%s/console" doctrine:database:drop --env=%s -q --force',
20-
__DIR__,
21-
$_ENV['BOOTSTRAP_ENV']
22-
));
23-
24-
passthru(sprintf(
25-
'php "%s/console" doctrine:database:create --env=%s -q',
26-
__DIR__,
27-
$_ENV['BOOTSTRAP_ENV']
28-
));
29-
30-
passthru(sprintf(
31-
'php "%s/console" doctrine:schema:drop --env=%s -q --force',
32-
__DIR__,
33-
$_ENV['BOOTSTRAP_ENV']
34-
));
35-
36-
passthru(sprintf(
37-
'php "%s/console" doctrine:schema:create --env=%s -q',
38-
__DIR__,
39-
$_ENV['BOOTSTRAP_ENV']
40-
));
41-
42-
passthru(sprintf(
43-
'php "%s/console" doctrine:fixtures:load --env=%s -q --no-interaction --purge-with-truncate',
44-
__DIR__,
45-
$_ENV['BOOTSTRAP_ENV']
46-
));
47-
}
48-
49-
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
50-
51-
return $loader;
3+
namespace { $loader = require_once __DIR__.'/autoload.php'; }

app/bootstrap_test.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
passthru(__DIR__.'/console --env=test -q doctrine:database:drop --force');
4+
passthru(__DIR__.'/console --env=test -q doctrine:database:create');
5+
passthru(__DIR__.'/console --env=test -q doctrine:schema:drop --force');
6+
passthru(__DIR__.'/console --env=test -q doctrine:schema:create');
7+
passthru(__DIR__.'/console --env=test -q doctrine:fixtures:load -n');
8+
9+
require __DIR__.'/bootstrap.php';

app/config/config.php

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
use AuthBucket\Push\Tests\TestBundle\Entity\ModelManagerFactory;
134
use Doctrine\Common\Annotations\AnnotationReader;
145
use Doctrine\Common\Cache\FilesystemCache;
156
use Doctrine\ORM\EntityManager;
167
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
178
use Doctrine\ORM\Tools\Setup;
189

10+
// File where logs are written to.
11+
$app['monolog.logfile'] = __DIR__.'/../logs/'.$app['env'].'.log';
12+
1913
// Define SQLite DB path.
2014
$app['db.options'] = array(
2115
'driver' => 'pdo_sqlite',
@@ -27,7 +21,7 @@
2721
$conn = $app['dbs']['default'];
2822
$em = $app['dbs.event_manager']['default'];
2923

30-
$driver = new AnnotationDriver(new AnnotationReader(), array(__DIR__.'/../../tests/AuthBucket/Push/Tests/TestBundle/Entity'));
24+
$driver = new AnnotationDriver(new AnnotationReader(), array(__DIR__.'/../../tests/TestBundle/Entity'));
3125
$cache = new FilesystemCache(__DIR__.'/../cache/'.$app['env']);
3226

3327
$config = Setup::createConfiguration(false);
@@ -59,5 +53,5 @@
5953
$app['debug'] = true;
6054

6155
$app['twig.path'] = array(
62-
__DIR__.'/../../tests/AuthBucket/Push/Tests/TestBundle/Resources/views',
56+
__DIR__.'/../../tests/TestBundle/Resources/views',
6357
);

app/config/config_dev.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
require __DIR__.'/config.php';
134

14-
require __DIR__.'/routing.php';
5+
require __DIR__.'/routing_dev.php';

app/config/config_prod.php

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
require __DIR__.'/config.php';

app/config/config_test.php

-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
require __DIR__.'/config_dev.php';
134

145
$app['session.test'] = true;

app/config/routing.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
12-
require __DIR__.'/../../tests/AuthBucket/Push/Tests/TestBundle/Resources/config/routing.php';
3+
require __DIR__.'/../../tests/TestBundle/Resources/config/routing.php';

app/config/routing_dev.php

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
123
require __DIR__.'/routing.php';

app/config/security.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
<?php
22

3-
/**
4-
* This file is part of the authbucket/push-php package.
5-
*
6-
* (c) Wong Hoi Sing Edison <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
12-
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
13-
143
$app['security.encoder.digest'] = $app->share(function ($app) {
15-
return new PlaintextPasswordEncoder();
4+
return new Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder();
165
});
176

187
$app['security.user_provider.admin'] = $app['security.user_provider.inmemory._proto'](array(

app/console

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ EOT
296296
$executor = new ORMExecutor($em, $purger);
297297

298298
$loader = new Loader();
299-
$loader->loadFromDirectory(__DIR__ . '/../tests/AuthBucket/Push/Tests/TestBundle/DataFixtures/ORM');
299+
$loader->loadFromDirectory(__DIR__ . '/../tests/TestBundle/DataFixtures/ORM');
300300
$executor->execute($loader->getFixtures());
301301
});
302302

@@ -338,7 +338,7 @@ EOF
338338

339339
$env = $input->getParameterOption(array('--env', '-e'), 'dev');
340340
$router = $input->getOption('router')
341-
?: sprintf('%s/../tests/AuthBucket/Push/Tests/TestBundle/Resources/config/router_%s.php', __DIR__, $env);
341+
?: sprintf('%s/../tests/TestBundle/Resources/config/router_%s.php', __DIR__, $env);
342342

343343
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
344344
$builder->setWorkingDirectory($input->getOption('docroot'));

composer.json

+31-21
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
}
88
],
99
"autoload": {
10-
"psr-0": {
11-
"AuthBucket\\Push": "src/",
12-
"AuthBucket\\Push\\Tests": "tests/"
10+
"psr-4": {
11+
"AuthBucket\\Push\\": "src/"
12+
}
13+
},
14+
"autoload-dev": {
15+
"psr-4": {
16+
"AuthBucket\\Push\\Tests\\": "tests/"
1317
}
1418
},
1519
"description": "Push notifications for mobile devices based on the Symfony Components",
1620
"extra": {
1721
"branch-alias": {
18-
"dev-develop": "0.x-dev",
19-
"dev-master": "0.0.x-dev"
22+
"dev-develop": "1.x-dev",
23+
"dev-master": "1.0.x-dev"
2024
}
2125
},
2226
"homepage": "https://github.com/authbucket/push-php",
@@ -32,33 +36,39 @@
3236
"require": {
3337
"authbucket/oauth2-php": "~2.3",
3438
"guzzle/guzzle": "~3.9",
35-
"php": ">=5.3.9",
36-
"symfony/http-foundation": "~2.3",
37-
"symfony/http-kernel": "~2.3",
38-
"symfony/security": "~2.3",
39-
"symfony/serializer": "~2.3",
40-
"symfony/validator": "~2.3"
39+
"php": ">=5.5.9",
40+
"psr/log": "~1.0",
41+
"symfony/http-foundation": "~2.7",
42+
"symfony/http-kernel": "~2.7",
43+
"symfony/security": "~2.7",
44+
"symfony/serializer": "~2.7",
45+
"symfony/validator": "~2.7"
4146
},
4247
"require-dev": {
4348
"doctrine/data-fixtures": "~1.0",
4449
"doctrine/orm": "~2.2",
4550
"ext-openssl": "*",
4651
"ext-pdo_sqlite": "*",
4752
"fabpot/php-cs-fixer": "@stable",
48-
"monolog/monolog": "~1.0",
53+
"monolog/monolog": "~1.4",
4954
"phpunit/phpunit": "@stable",
5055
"sami/sami": "@stable",
5156
"satooshi/php-coveralls": "dev-master",
52-
"silex/silex": "~1.2",
53-
"symfony/browser-kit": "~2.3",
54-
"symfony/config": "~2.3",
55-
"symfony/css-selector": "~2.3",
56-
"symfony/form": "~2.3",
57-
"symfony/locale": "~2.3",
58-
"symfony/process": "~2.3",
59-
"symfony/translation": "~2.3",
60-
"symfony/twig-bridge": "~2.3",
57+
"silex/silex": "~1.3",
58+
"symfony/browser-kit": "~2.7",
59+
"symfony/config": "~2.7",
60+
"symfony/css-selector": "~2.7",
61+
"symfony/form": "~2.7",
62+
"symfony/process": "~2.7",
63+
"symfony/translation": "~2.7",
64+
"symfony/twig-bridge": "~2.7",
6165
"twig/twig": "~1.8"
6266
},
67+
"scripts": {
68+
"coveralls": "coveralls -v; exit 0",
69+
"php-cs-fixer": "php-cs-fixer fix --config-file .php-cs-fixer.php; exit 0",
70+
"phpunit": "phpunit -c phpunit.xml.dist; exit 0",
71+
"sami": "sami.php update .sami.php; exit 0"
72+
},
6373
"type": "library"
6474
}

0 commit comments

Comments
 (0)