Skip to content

Commit

Permalink
Merge pull request #166 from anime-db/analysis-8Lmyak
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
peter-gribanov committed Sep 3, 2016
2 parents 83ad491 + 9a14315 commit d50e09f
Show file tree
Hide file tree
Showing 86 changed files with 492 additions and 619 deletions.
4 changes: 1 addition & 3 deletions app/AppCache.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

require_once __DIR__.'/AppKernel.php';

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
Expand Down
6 changes: 2 additions & 4 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

Expand All @@ -29,7 +27,7 @@ public function registerBundles()
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),
new AnimeDb\Bundle\AnimeDbBundle\AnimeDbAnimeDbBundle()
new AnimeDb\Bundle\AnimeDbBundle\AnimeDbAnimeDbBundle(),
];
// connection the bandles to be installed in the future
$bundles = array_merge($bundles, include __DIR__.'/bundles.php');
Expand Down
3 changes: 2 additions & 1 deletion app/autoload.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

/* @var $loader \Composer\Autoload\ClassLoader */
Expand All @@ -11,6 +12,6 @@
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
AnnotationRegistry::registerLoader([$loader, 'loadClass']);

return $loader;
6 changes: 3 additions & 3 deletions app/router.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

if (PHP_SAPI != 'cli-server') { // run not in cli-server
echo 'This script can be run from the CLI-server only.';

return true;
} elseif ($_SERVER['SCRIPT_NAME'] == '/update.log' || $_SERVER['SCRIPT_NAME'] == '/app_dev.php') {
return false; // immediately return the update log or dev
} else {
include __DIR__.'/../web/app.php';

return true;
}
4 changes: 1 addition & 3 deletions src/AnimeDbAnimeDbBundle.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
Expand Down
5 changes: 2 additions & 3 deletions src/Client/GitHub.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Client;

use AnimeDb\Bundle\AnimeDbBundle\Composer\Composer;
Expand Down Expand Up @@ -39,6 +37,7 @@ public function getTags($repository)
{
/* @var $response Response */
$response = $this->client->get('repos/'.$repository.'/tags')->send();

return json_decode($response->getBody(true), true);
}

Expand Down
7 changes: 3 additions & 4 deletions src/Command/DeliverEventsCommand.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
Expand All @@ -32,7 +30,8 @@ protected function configure()
*
* @return bool
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->getContainer()->get('anime_db.event_dispatcher')->shippingDeferredEvents();
}
}
9 changes: 4 additions & 5 deletions src/Command/UpdateCommand.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
Expand Down Expand Up @@ -37,7 +35,8 @@ protected function configure()
*
* @return bool
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output)
{
/* @var $composer Composer */
$composer = $this->getContainer()->get('anime_db.composer');
$composer->setIO(new ConsoleIO($input, $output, $this->getHelperSet()));
Expand Down Expand Up @@ -110,7 +109,7 @@ protected function doUpdateItself(array $tag, Composer $composer, OutputInterfac
}

/**
* Rewrite the application files
* Rewrite the application files.
*
* @param string $from
*/
Expand Down
15 changes: 7 additions & 8 deletions src/Composer/Composer.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Composer;

use Composer\Factory;
Expand All @@ -34,7 +32,7 @@ class Composer
protected $loader;

/**
* Lock file composer.lock
* Lock file composer.lock.
*
* @var string
*/
Expand Down Expand Up @@ -100,7 +98,7 @@ protected function getComposer()
}

/**
* Reload Composer
* Reload Composer.
*/
public function reload()
{
Expand Down Expand Up @@ -149,6 +147,7 @@ public function getPackageFromConfigFile($config)
if (!file_exists($config)) {
throw new \RuntimeException('File "'.$config.'" not found');
}

return $this->loader->load((new JsonFile($config))->read(), 'Composer\Package\RootPackage');
}

Expand All @@ -168,7 +167,7 @@ public function getInstaller()
}

/**
* Get version compatible
* Get version compatible.
*
* 3.2.1-RC2 => 3.2.1.6.2
*
Expand All @@ -185,7 +184,7 @@ public static function getVersionCompatible($version)
'alpha' => 3,
'beta' => 4,
'stable' => 5, // is not a real suffix. use it if suffix is not exists
'rc' => 6
'rc' => 6,
];

$reg = '/^v?(?<version>\d+\.\d+\.\d+)(?:-(?<suffix>dev|patch|alpha|beta|rc)(?<suffix_version>\d+)?)?$/i';
Expand All @@ -196,7 +195,7 @@ public static function getVersionCompatible($version)
// suffix version
if (isset($match['suffix'])) {
$suffix = $suffixes[strtolower($match['suffix'])].'.';
$suffix .= isset($match['suffix_version']) ? (int)$match['suffix_version'] : 1;
$suffix .= isset($match['suffix_version']) ? (int) $match['suffix_version'] : 1;
} else {
$suffix = $suffixes['stable'].'.0';
}
Expand Down
5 changes: 2 additions & 3 deletions src/Composer/Job/BaseAddConfig.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Composer\Job;

use Symfony\Component\Finder\Finder;
Expand Down Expand Up @@ -71,6 +69,7 @@ private function getPackageConfig($name, $option = '')
/* @var $file \SplFileInfo */
foreach ($finder as $file) {
$path = str_replace(DIRECTORY_SEPARATOR, '/', $file->getPathname());

return substr($path, strrpos($path, '/Resources/config/'));
}

Expand Down
6 changes: 2 additions & 4 deletions src/Composer/Job/Config/Add.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Composer\Job\Config;

use AnimeDb\Bundle\AnimeDbBundle\Composer\Job\BaseAddConfig;
use AnimeDb\Bundle\AnimeDbBundle\Manipulator\Config;

/**
* Job: Add package to config
* Job: Add package to config.
*/
class Add extends BaseAddConfig
{
Expand Down
6 changes: 2 additions & 4 deletions src/Composer/Job/Config/Remove.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Composer\Job\Config;

use AnimeDb\Bundle\AnimeDbBundle\Composer\Job\Job;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use AnimeDb\Bundle\AnimeDbBundle\Manipulator\Config;

/**
* Job: Remove package from config
* Job: Remove package from config.
*/
class Remove extends Job
{
Expand Down
10 changes: 5 additions & 5 deletions src/Composer/Job/Container.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
/**
* AnimeDb package
* AnimeDb package.
*
* @package AnimeDb
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
*/

namespace AnimeDb\Bundle\AnimeDbBundle\Composer\Job;

use AnimeDb\Bundle\AnimeDbBundle\Event\Dispatcher;
Expand Down Expand Up @@ -63,6 +61,7 @@ public function getEventDispatcher()
if (!($this->dispatcher instanceof Dispatcher)) {
$this->dispatcher = new Dispatcher($this->root_dir);
}

return $this->dispatcher;
}

Expand Down Expand Up @@ -113,7 +112,7 @@ public function addJob(Job $job)
}

/**
* Execute all jobs
* Execute all jobs.
*/
public function execute()
{
Expand Down Expand Up @@ -150,7 +149,7 @@ public function executeCommand($cmd, $timeout = 300)
}

/**
* Get path to php executable
* Get path to php executable.
*
* @throws \RuntimeException
*
Expand All @@ -166,6 +165,7 @@ protected function getPhp()
);
}
}

return $this->php_path;
}
}

0 comments on commit d50e09f

Please sign in to comment.