Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit.

  • Loading branch information...
commit 689e8995866164d40c14c56d0136eb5c1646cbfc 0 parents
Kai Sellgren kaisellgren authored

Showing 32 changed files with 2,895 additions and 0 deletions. Show diff stats Hide diff stats

  1. +8 0 .gitignore
  2. +9 0 app/AppCache.php
  3. +31 0 app/AppKernel.php
  4. +13 0 app/Resources/views/base.html.twig
  5. +603 0 app/SymfonyRequirements.php
  6. +16 0 app/autoload.php
  7. +1,710 0 app/bootstrap.php.cache
  8. +55 0 app/check.php
  9. +29 0 app/config/config.yml
  10. +6 0 app/config/config_dev.yml
  11. +2 0  app/config/config_prod.yml
  12. +7 0 app/config/config_test.yml
  13. +15 0 app/config/parameters.yml
  14. +7 0 app/config/routing.yml
  15. +2 0  app/config/routing_dev.yml
  16. +34 0 app/config/security.yml
  17. +22 0 app/console
  18. +41 0 app/phpunit.xml.dist
  19. +38 0 composer.json
  20. +89 0 composer.lock
  21. +2 0  sf.bat
  22. +2 0  sf.sh
  23. +13 0 src/Loiste/MinesweeperBundle/Controller/DefaultController.php
  24. +29 0 src/Loiste/MinesweeperBundle/DependencyInjection/Configuration.php
  25. +28 0 src/Loiste/MinesweeperBundle/DependencyInjection/LoisteMinesweeperExtension.php
  26. +9 0 src/Loiste/MinesweeperBundle/LoisteMinesweeperBundle.php
  27. +3 0  src/Loiste/MinesweeperBundle/Resources/config/routing.yml
  28. +7 0 src/Loiste/MinesweeperBundle/Resources/config/services.yml
  29. +1 0  src/Loiste/MinesweeperBundle/Resources/views/Default/index.html.twig
  30. +10 0 web/.htaccess
  31. +24 0 web/app.php
  32. +30 0 web/app_dev.php
8 .gitignore
... ... @@ -0,0 +1,8 @@
  1 +web/bundles/
  2 +app/cache/*
  3 +app/logs/*
  4 +build/
  5 +vendor
  6 +bin
  7 +.idea
  8 +composer.phar
9 app/AppCache.php
... ... @@ -0,0 +1,9 @@
  1 +<?php
  2 +
  3 +require_once __DIR__ . '/AppKernel.php';
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
  6 +
  7 +class AppCache extends HttpCache
  8 +{
  9 +}
31 app/AppKernel.php
... ... @@ -0,0 +1,31 @@
  1 +<?php
  2 +
  3 +use Symfony\Component\HttpKernel\Kernel;
  4 +use Symfony\Component\Config\Loader\LoaderInterface;
  5 +
  6 +class AppKernel extends Kernel
  7 +{
  8 + public function registerBundles()
  9 + {
  10 + $bundles = array(
  11 + new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  12 + new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  13 + new Symfony\Bundle\TwigBundle\TwigBundle(),
  14 + new Symfony\Bundle\AsseticBundle\AsseticBundle(),
  15 + new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  16 + new Loiste\MinesweeperBundle\LoisteMinesweeperBundle(),
  17 + );
  18 +
  19 + if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  20 + $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  21 + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  22 + }
  23 +
  24 + return $bundles;
  25 + }
  26 +
  27 + public function registerContainerConfiguration(LoaderInterface $loader)
  28 + {
  29 + $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
  30 + }
  31 +}
13 app/Resources/views/base.html.twig
... ... @@ -0,0 +1,13 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="UTF-8" />
  5 + <title>{% block title %}Welcome!{% endblock %}</title>
  6 + {% block stylesheets %}{% endblock %}
  7 + <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
  8 + </head>
  9 + <body>
  10 + {% block body %}{% endblock %}
  11 + {% block javascripts %}{% endblock %}
  12 + </body>
  13 +</html>
603 app/SymfonyRequirements.php
... ... @@ -0,0 +1,603 @@
  1 +<?php
  2 +
  3 +/*
  4 + * This file is part of the Symfony package.
  5 + *
  6 + * (c) Fabien Potencier <fabien@symfony.com>
  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 +/**
  13 + * Represents a single PHP requirement, e.g. an installed extension.
  14 + * It can be a mandatory requirement or an optional recommendation.
  15 + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
  16 + *
  17 + * This file must be compatible with PHP 5.2+.
  18 + *
  19 + * ************** CAUTION **************
  20 + *
  21 + * DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER
  22 + *
  23 + * If you want to change this file, edit the one in the
  24 + * SensioDistributionBundle instead.
  25 + *
  26 + * ************** CAUTION **************
  27 + *
  28 + * @author Tobias Schultze <http://tobion.de>
  29 + */
  30 +class Requirement
  31 +{
  32 + private $fulfilled;
  33 + private $testMessage;
  34 + private $helpText;
  35 + private $helpHtml;
  36 + private $optional;
  37 +
  38 + /**
  39 + * Constructor that initializes the requirement.
  40 + *
  41 + * @param Boolean $fulfilled Whether the requirement is fulfilled
  42 + * @param string $testMessage The message for testing the requirement
  43 + * @param string $helpHtml The help text formatted in HTML for resolving the problem
  44 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  45 + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
  46 + */
  47 + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
  48 + {
  49 + $this->fulfilled = (Boolean) $fulfilled;
  50 + $this->testMessage = (string) $testMessage;
  51 + $this->helpHtml = (string) $helpHtml;
  52 + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
  53 + $this->optional = (Boolean) $optional;
  54 + }
  55 +
  56 + /**
  57 + * Returns whether the requirement is fulfilled.
  58 + *
  59 + * @return Boolean true if fulfilled, otherwise false
  60 + */
  61 + public function isFulfilled()
  62 + {
  63 + return $this->fulfilled;
  64 + }
  65 +
  66 + /**
  67 + * Returns the message for testing the requirement.
  68 + *
  69 + * @return string The test message
  70 + */
  71 + public function getTestMessage()
  72 + {
  73 + return $this->testMessage;
  74 + }
  75 +
  76 + /**
  77 + * Returns the help text for resolving the problem
  78 + *
  79 + * @return string The help text
  80 + */
  81 + public function getHelpText()
  82 + {
  83 + return $this->helpText;
  84 + }
  85 +
  86 + /**
  87 + * Returns the help text formatted in HTML.
  88 + *
  89 + * @return string The HTML help
  90 + */
  91 + public function getHelpHtml()
  92 + {
  93 + return $this->helpHtml;
  94 + }
  95 +
  96 + /**
  97 + * Returns whether this is only an optional recommendation and not a mandatory requirement.
  98 + *
  99 + * @return Boolean true if optional, false if mandatory
  100 + */
  101 + public function isOptional()
  102 + {
  103 + return $this->optional;
  104 + }
  105 +}
  106 +
  107 +/**
  108 + * Represents a PHP requirement in form of a php.ini configuration.
  109 + *
  110 + * @author Tobias Schultze <http://tobion.de>
  111 + */
  112 +class PhpIniRequirement extends Requirement
  113 +{
  114 + /**
  115 + * Constructor that initializes the requirement.
  116 + *
  117 + * @param string $cfgName The configuration name used for ini_get()
  118 + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
  119 + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
  120 + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
  121 + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
  122 + Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
  123 + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
  124 + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
  125 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  126 + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
  127 + */
  128 + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
  129 + {
  130 + $cfgValue = ini_get($cfgName);
  131 +
  132 + if (is_callable($evaluation)) {
  133 + if (null === $testMessage || null === $helpHtml) {
  134 + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
  135 + }
  136 +
  137 + $fulfilled = call_user_func($evaluation, $cfgValue);
  138 + } else {
  139 + if (null === $testMessage) {
  140 + $testMessage = sprintf('%s %s be %s in php.ini',
  141 + $cfgName,
  142 + $optional ? 'should' : 'must',
  143 + $evaluation ? 'enabled' : 'disabled'
  144 + );
  145 + }
  146 +
  147 + if (null === $helpHtml) {
  148 + $helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
  149 + $cfgName,
  150 + $evaluation ? 'on' : 'off'
  151 + );
  152 + }
  153 +
  154 + $fulfilled = $evaluation == $cfgValue;
  155 + }
  156 +
  157 + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
  158 + }
  159 +}
  160 +
  161 +/**
  162 + * A RequirementCollection represents a set of Requirement instances.
  163 + *
  164 + * Users of PHP 5.2 should be able to run the requirements checks.
  165 + * This is why the class must be compatible with PHP 5.2
  166 + * (e.g. not using namespaces and closures).
  167 + *
  168 + * @author Tobias Schultze <http://tobion.de>
  169 + */
  170 +class RequirementCollection implements IteratorAggregate
  171 +{
  172 + private $requirements = array();
  173 +
  174 + /**
  175 + * Gets the current RequirementCollection as an Iterator.
  176 + *
  177 + * @return Traversable A Traversable interface
  178 + */
  179 + public function getIterator()
  180 + {
  181 + return new ArrayIterator($this->requirements);
  182 + }
  183 +
  184 + /**
  185 + * Adds a Requirement.
  186 + *
  187 + * @param Requirement $requirement A Requirement instance
  188 + */
  189 + public function add(Requirement $requirement)
  190 + {
  191 + $this->requirements[] = $requirement;
  192 + }
  193 +
  194 + /**
  195 + * Adds a mandatory requirement.
  196 + *
  197 + * @param Boolean $fulfilled Whether the requirement is fulfilled
  198 + * @param string $testMessage The message for testing the requirement
  199 + * @param string $helpHtml The help text formatted in HTML for resolving the problem
  200 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  201 + */
  202 + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
  203 + {
  204 + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
  205 + }
  206 +
  207 + /**
  208 + * Adds an optional recommendation.
  209 + *
  210 + * @param Boolean $fulfilled Whether the recommendation is fulfilled
  211 + * @param string $testMessage The message for testing the recommendation
  212 + * @param string $helpHtml The help text formatted in HTML for resolving the problem
  213 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  214 + */
  215 + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
  216 + {
  217 + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
  218 + }
  219 +
  220 + /**
  221 + * Adds a mandatory requirement in form of a php.ini configuration.
  222 + *
  223 + * @param string $cfgName The configuration name used for ini_get()
  224 + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
  225 + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
  226 + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
  227 + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
  228 + Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
  229 + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
  230 + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
  231 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  232 + */
  233 + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
  234 + {
  235 + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
  236 + }
  237 +
  238 + /**
  239 + * Adds an optional recommendation in form of a php.ini configuration.
  240 + *
  241 + * @param string $cfgName The configuration name used for ini_get()
  242 + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
  243 + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
  244 + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
  245 + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
  246 + Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
  247 + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
  248 + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
  249 + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  250 + */
  251 + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
  252 + {
  253 + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
  254 + }
  255 +
  256 + /**
  257 + * Adds a requirement collection to the current set of requirements.
  258 + *
  259 + * @param RequirementCollection $collection A RequirementCollection instance
  260 + */
  261 + public function addCollection(RequirementCollection $collection)
  262 + {
  263 + $this->requirements = array_merge($this->requirements, $collection->all());
  264 + }
  265 +
  266 + /**
  267 + * Returns both requirements and recommendations.
  268 + *
  269 + * @return array Array of Requirement instances
  270 + */
  271 + public function all()
  272 + {
  273 + return $this->requirements;
  274 + }
  275 +
  276 + /**
  277 + * Returns all mandatory requirements.
  278 + *
  279 + * @return array Array of Requirement instances
  280 + */
  281 + public function getRequirements()
  282 + {
  283 + $array = array();
  284 + foreach ($this->requirements as $req) {
  285 + if (!$req->isOptional()) {
  286 + $array[] = $req;
  287 + }
  288 + }
  289 +
  290 + return $array;
  291 + }
  292 +
  293 + /**
  294 + * Returns the mandatory requirements that were not met.
  295 + *
  296 + * @return array Array of Requirement instances
  297 + */
  298 + public function getFailedRequirements()
  299 + {
  300 + $array = array();
  301 + foreach ($this->requirements as $req) {
  302 + if (!$req->isFulfilled() && !$req->isOptional()) {
  303 + $array[] = $req;
  304 + }
  305 + }
  306 +
  307 + return $array;
  308 + }
  309 +
  310 + /**
  311 + * Returns all optional recommmendations.
  312 + *
  313 + * @return array Array of Requirement instances
  314 + */
  315 + public function getRecommendations()
  316 + {
  317 + $array = array();
  318 + foreach ($this->requirements as $req) {
  319 + if ($req->isOptional()) {
  320 + $array[] = $req;
  321 + }
  322 + }
  323 +
  324 + return $array;
  325 + }
  326 +
  327 + /**
  328 + * Returns the recommendations that were not met.
  329 + *
  330 + * @return array Array of Requirement instances
  331 + */
  332 + public function getFailedRecommendations()
  333 + {
  334 + $array = array();
  335 + foreach ($this->requirements as $req) {
  336 + if (!$req->isFulfilled() && $req->isOptional()) {
  337 + $array[] = $req;
  338 + }
  339 + }
  340 +
  341 + return $array;
  342 + }
  343 +
  344 + /**
  345 + * Returns whether a php.ini configuration is not correct.
  346 + *
  347 + * @return Boolean php.ini configuration problem?
  348 + */
  349 + public function hasPhpIniConfigIssue()
  350 + {
  351 + foreach ($this->requirements as $req) {
  352 + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
  353 + return true;
  354 + }
  355 + }
  356 +
  357 + return false;
  358 + }
  359 +
  360 + /**
  361 + * Returns the PHP configuration file (php.ini) path.
  362 + *
  363 + * @return string|false php.ini file path
  364 + */
  365 + public function getPhpIniConfigPath()
  366 + {
  367 + return get_cfg_var('cfg_file_path');
  368 + }
  369 +}
  370 +
  371 +/**
  372 + * This class specifies all requirements and optional recommendations that
  373 + * are necessary to run the Symfony Standard Edition.
  374 + *
  375 + * @author Tobias Schultze <http://tobion.de>
  376 + */
  377 +class SymfonyRequirements extends RequirementCollection
  378 +{
  379 + const REQUIRED_PHP_VERSION = '5.3.3';
  380 +
  381 + /**
  382 + * Constructor that initializes the requirements.
  383 + */
  384 + public function __construct()
  385 + {
  386 + /* mandatory requirements follow */
  387 +
  388 + $installedPhpVersion = phpversion();
  389 +
  390 + $this->addRequirement(
  391 + version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
  392 + sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
  393 + sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
  394 + Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
  395 + $installedPhpVersion, self::REQUIRED_PHP_VERSION),
  396 + sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
  397 + );
  398 +
  399 + $this->addRequirement(
  400 + is_dir(__DIR__.'/../vendor/composer'),
  401 + 'Vendor libraries must be installed',
  402 + 'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
  403 + 'Then run "<strong>php composer.phar install</strong>" to install them.'
  404 + );
  405 +
  406 + $this->addRequirement(
  407 + file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
  408 + 'Outdated requirements file',
  409 + 'Your requirements file is outdated. Run composer install and re-check your configuration.'
  410 + );
  411 +
  412 + $baseDir = basename(__DIR__);
  413 + $this->addRequirement(
  414 + is_writable(__DIR__.'/cache'),
  415 + "$baseDir/cache/ directory must be writable",
  416 + "Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
  417 + );
  418 +
  419 + $this->addRequirement(
  420 + is_writable(__DIR__.'/logs'),
  421 + "$baseDir/logs/ directory must be writable",
  422 + "Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
  423 + );
  424 +
  425 + $this->addPhpIniRequirement(
  426 + 'date.timezone', true, false,
  427 + 'date.timezone setting must be set',
  428 + 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
  429 + );
  430 +
  431 + if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
  432 + $this->addRequirement(
  433 + (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
  434 + sprintf('Default timezone "%s" is not supported by your installation of PHP', date_default_timezone_get()),
  435 + 'Fix your <strong>php.ini</strong> file (check for typos and have a look at the list of deprecated timezones http://php.net/manual/en/timezones.others.php).'
  436 + );
  437 + }
  438 +
  439 + $this->addRequirement(
  440 + function_exists('json_encode'),
  441 + 'json_encode() must be available',
  442 + 'Install and enable the <strong>JSON</strong> extension.'
  443 + );
  444 +
  445 + $this->addRequirement(
  446 + function_exists('session_start'),
  447 + 'session_start() must be available',
  448 + 'Install and enable the <strong>session</strong> extension.'
  449 + );
  450 +
  451 + $this->addRequirement(
  452 + function_exists('ctype_alpha'),
  453 + 'ctype_alpha() must be available',
  454 + 'Install and enable the <strong>ctype</strong> extension.'
  455 + );
  456 +
  457 + $this->addRequirement(
  458 + function_exists('token_get_all'),
  459 + 'token_get_all() must be available',
  460 + 'Install and enable the <strong>Tokenizer</strong> extension.'
  461 + );
  462 +
  463 + $this->addRequirement(
  464 + function_exists('simplexml_import_dom'),
  465 + 'simplexml_import_dom() must be available',
  466 + 'Install and enable the <strong>SimpleXML</strong> extension.'
  467 + );
  468 +
  469 + $this->addRequirement(
  470 + !(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='),
  471 + 'APC version must be at least 3.0.17',
  472 + 'Upgrade your <strong>APC</strong> extension (3.0.17+)'
  473 + );
  474 +
  475 + $this->addPhpIniRequirement('detect_unicode', false);
  476 +
  477 + $this->addPhpIniRequirement(
  478 + 'suhosin.executor.include.whitelist',
  479 + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
  480 + true,
  481 + 'suhosin.executor.include.whitelist must be configured correctly in php.ini',
  482 + 'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
  483 + );
  484 +
  485 + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
  486 +
  487 + $this->addRequirement(
  488 + null !== $pcreVersion && $pcreVersion > 8.0,
  489 + sprintf('PCRE extension must be available and at least 8.0 (%s installed)', $pcreVersion ? $pcreVersion : 'not'),
  490 + 'Upgrade your <strong>PCRE</strong> extension (8.0+)'
  491 + );
  492 +
  493 + /* optional recommendations follow */
  494 +
  495 + $this->addRecommendation(
  496 + version_compare($installedPhpVersion, '5.3.4', '>='),
  497 + sprintf('Your project might not work properly ("Notice: Trying to get property of non-object") due to the PHP bug #52083 before PHP 5.3.4 (%s installed)', $installedPhpVersion),
  498 + 'Install PHP 5.3.4 or newer'
  499 + );
  500 +
  501 + $this->addRecommendation(
  502 + version_compare($installedPhpVersion, '5.3.8', '>='),
  503 + sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion),
  504 + 'Install PHP 5.3.8 or newer if your project uses annotations'
  505 + );
  506 +
  507 + $this->addRecommendation(
  508 + class_exists('DomDocument'),
  509 + 'PHP-XML module should be installed',
  510 + 'Install and enable the <strong>PHP-XML</strong> module.'
  511 + );
  512 +
  513 + $this->addRecommendation(
  514 + function_exists('mb_strlen'),
  515 + 'mb_strlen() should be available',
  516 + 'Install and enable the <strong>mbstring</strong> extension.'
  517 + );
  518 +
  519 + $this->addRecommendation(
  520 + function_exists('iconv'),
  521 + 'iconv() should be available',
  522 + 'Install and enable the <strong>iconv</strong> extension.'
  523 + );
  524 +
  525 + $this->addRecommendation(
  526 + function_exists('utf8_decode'),
  527 + 'utf8_decode() should be available',
  528 + 'Install and enable the <strong>XML</strong> extension.'
  529 + );
  530 +
  531 + if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  532 + $this->addRecommendation(
  533 + function_exists('posix_isatty'),
  534 + 'posix_isatty() should be available',
  535 + 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
  536 + );
  537 + }
  538 +
  539 + $this->addRecommendation(
  540 + class_exists('Locale'),
  541 + 'intl extension should be available',
  542 + 'Install and enable the <strong>intl</strong> extension (used for validators).'
  543 + );
  544 +
  545 + if (class_exists('Locale')) {
  546 + if (defined('INTL_ICU_VERSION')) {
  547 + $version = INTL_ICU_VERSION;
  548 + } else {
  549 + $reflector = new ReflectionExtension('intl');
  550 +
  551 + ob_start();
  552 + $reflector->info();
  553 + $output = strip_tags(ob_get_clean());
  554 +
  555 + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
  556 + $version = $matches[1];
  557 + }
  558 +
  559 + $this->addRecommendation(
  560 + version_compare($version, '4.0', '>='),
  561 + 'intl ICU version should be at least 4+',
  562 + 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
  563 + );
  564 + }
  565 +
  566 + $accelerator =
  567 + (function_exists('apc_store') && ini_get('apc.enabled'))
  568 + ||
  569 + function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
  570 + ||
  571 + function_exists('xcache_set')
  572 + ;
  573 +
  574 + $this->addRecommendation(
  575 + $accelerator,
  576 + 'a PHP accelerator should be installed',
  577 + 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
  578 + );
  579 +
  580 + $this->addPhpIniRecommendation('short_open_tag', false);
  581 +
  582 + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
  583 +
  584 + $this->addPhpIniRecommendation('register_globals', false, true);
  585 +
  586 + $this->addPhpIniRecommendation('session.auto_start', false);
  587 +
  588 + $this->addRecommendation(
  589 + class_exists('PDO'),
  590 + 'PDO should be installed',
  591 + 'Install <strong>PDO</strong> (mandatory for Doctrine).'
  592 + );
  593 +
  594 + if (class_exists('PDO')) {
  595 + $drivers = PDO::getAvailableDrivers();
  596 + $this->addRecommendation(
  597 + count($drivers),
  598 + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
  599 + 'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
  600 + );
  601 + }
  602 + }
  603 +}
16 app/autoload.php
... ... @@ -0,0 +1,16 @@
  1 +<?php
  2 +
  3 +use Doctrine\Common\Annotations\AnnotationRegistry;
  4 +
  5 +$loader = require __DIR__.'/../vendor/autoload.php';
  6 +
  7 +// intl
  8 +if (!function_exists('intl_get_error_code')) {
  9 + require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
  10 +
  11 + $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
  12 +}
  13 +
  14 +AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  15 +
  16 +return $loader;
1,710 app/bootstrap.php.cache
... ... @@ -0,0 +1,1710 @@
  1 +<?php
  2 +
  3 +namespace { $loader = require_once __DIR__.'/autoload.php'; }
  4 +
  5 +
  6 +
  7 +
  8 +
  9 +namespace Symfony\Component\DependencyInjection
  10 +{
  11 +
  12 +
  13 +interface ContainerAwareInterface
  14 +{
  15 +
  16 + public function setContainer(ContainerInterface $container = null);
  17 +}
  18 +}
  19 +
  20 +
  21 +
  22 +
  23 +namespace Symfony\Component\DependencyInjection
  24 +{
  25 +
  26 +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  27 +
  28 +
  29 +interface ContainerInterface
  30 +{
  31 + const EXCEPTION_ON_INVALID_REFERENCE = 1;
  32 + const NULL_ON_INVALID_REFERENCE = 2;
  33 + const IGNORE_ON_INVALID_REFERENCE = 3;
  34 + const SCOPE_CONTAINER = 'container';
  35 + const SCOPE_PROTOTYPE = 'prototype';
  36 +
  37 +
  38 + public function set($id, $service, $scope = self::SCOPE_CONTAINER);
  39 +
  40 +
  41 + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
  42 +
  43 +
  44 + public function has($id);
  45 +
  46 +
  47 + public function getParameter($name);
  48 +
  49 +
  50 + public function hasParameter($name);
  51 +
  52 +
  53 + public function setParameter($name, $value);
  54 +
  55 +
  56 + public function enterScope($name);
  57 +
  58 +
  59 + public function leaveScope($name);
  60 +
  61 +
  62 + public function addScope(ScopeInterface $scope);
  63 +
  64 +
  65 + public function hasScope($name);
  66 +
  67 +
  68 + public function isScopeActive($name);
  69 +}
  70 +}
  71 +
  72 +
  73 +
  74 +
  75 +namespace Symfony\Component\DependencyInjection
  76 +{
  77 +
  78 +
  79 +interface IntrospectableContainerInterface extends ContainerInterface
  80 +{
  81 +
  82 + public function initialized($id);
  83 +
  84 +}
  85 +}
  86 +
  87 +
  88 +
  89 +
  90 +namespace Symfony\Component\DependencyInjection
  91 +{
  92 +
  93 +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  94 +use Symfony\Component\DependencyInjection\Exception\RuntimeException;
  95 +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
  96 +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
  97 +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  98 +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  99 +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
  100 +
  101 +
  102 +class Container implements IntrospectableContainerInterface
  103 +{
  104 + protected $parameterBag;
  105 + protected $services;
  106 + protected $scopes;
  107 + protected $scopeChildren;
  108 + protected $scopedServices;
  109 + protected $scopeStacks;
  110 + protected $loading = array();
  111 +
  112 +
  113 + public function __construct(ParameterBagInterface $parameterBag = null)
  114 + {
  115 + $this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
  116 +
  117 + $this->services = array();
  118 + $this->scopes = array();
  119 + $this->scopeChildren = array();
  120 + $this->scopedServices = array();
  121 + $this->scopeStacks = array();
  122 +
  123 + $this->set('service_container', $this);
  124 + }
  125 +
  126 +
  127 + public function compile()
  128 + {
  129 + $this->parameterBag->resolve();
  130 +
  131 + $this->parameterBag = new FrozenParameterBag($this->parameterBag->all());
  132 + }
  133 +
  134 +
  135 + public function isFrozen()
  136 + {
  137 + return $this->parameterBag instanceof FrozenParameterBag;
  138 + }
  139 +
  140 +
  141 + public function getParameterBag()
  142 + {
  143 + return $this->parameterBag;
  144 + }
  145 +
  146 +
  147 + public function getParameter($name)
  148 + {
  149 + return $this->parameterBag->get($name);
  150 + }
  151 +
  152 +
  153 + public function hasParameter($name)
  154 + {
  155 + return $this->parameterBag->has($name);
  156 + }
  157 +
  158 +
  159 + public function setParameter($name, $value)
  160 + {
  161 + $this->parameterBag->set($name, $value);
  162 + }
  163 +
  164 +
  165 + public function set($id, $service, $scope = self::SCOPE_CONTAINER)
  166 + {
  167 + if (self::SCOPE_PROTOTYPE === $scope) {
  168 + throw new InvalidArgumentException('You cannot set services of scope "prototype".');
  169 + }
  170 +
  171 + $id = strtolower($id);
  172 +
  173 + if (self::SCOPE_CONTAINER !== $scope) {
  174 + if (!isset($this->scopedServices[$scope])) {
  175 + throw new RuntimeException('You cannot set services of inactive scopes.');
  176 + }
  177 +
  178 + $this->scopedServices[$scope][$id] = $service;
  179 + }
  180 +
  181 + $this->services[$id] = $service;
  182 + }
  183 +
  184 +
  185 + public function has($id)
  186 + {
  187 + $id = strtolower($id);
  188 +
  189 + return isset($this->services[$id]) || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_')).'Service');
  190 + }
  191 +
  192 +
  193 + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
  194 + {
  195 + $id = strtolower($id);
  196 +
  197 + if (isset($this->services[$id])) {
  198 + return $this->services[$id];
  199 + }
  200 +
  201 + if (isset($this->loading[$id])) {
  202 + throw new ServiceCircularReferenceException($id, array_keys($this->loading));
  203 + }
  204 +
  205 + if (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.' => '_')).'Service')) {
  206 + $this->loading[$id] = true;
  207 +
  208 + try {
  209 + $service = $this->$method();
  210 + } catch (\Exception $e) {
  211 + unset($this->loading[$id]);
  212 + throw $e;
  213 + }
  214 +
  215 + unset($this->loading[$id]);
  216 +
  217 + return $service;
  218 + }
  219 +
  220 + if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) {
  221 + throw new ServiceNotFoundException($id);
  222 + }
  223 + }
  224 +
  225 +
  226 + public function initialized($id)
  227 + {
  228 + return isset($this->services[strtolower($id)]);
  229 + }
  230 +
  231 +
  232 + public function getServiceIds()
  233 + {
  234 + $ids = array();
  235 + $r = new \ReflectionClass($this);
  236 + foreach ($r->getMethods() as $method) {
  237 + if (preg_match('/^get(.+)Service$/', $method->name, $match)) {
  238 + $ids[] = self::underscore($match[1]);
  239 + }
  240 + }
  241 +
  242 + return array_unique(array_merge($ids, array_keys($this->services)));
  243 + }
  244 +
  245 +
  246 + public function enterScope($name)
  247 + {
  248 + if (!isset($this->scopes[$name])) {
  249 + throw new InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name));
  250 + }
  251 +
  252 + if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) {
  253 + throw new RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name]));
  254 + }
  255 +
  256 + if (isset($this->scopedServices[$name])) {
  257 + $services = array($this->services, $name => $this->scopedServices[$name]);
  258 + unset($this->scopedServices[$name]);
  259 +
  260 + foreach ($this->scopeChildren[$name] as $child) {
  261 + $services[$child] = $this->scopedServices[$child];
  262 + unset($this->scopedServices[$child]);
  263 + }
  264 +
  265 + $this->services = call_user_func_array('array_diff_key', $services);
  266 + array_shift($services);
  267 +
  268 + if (!isset($this->scopeStacks[$name])) {
  269 + $this->scopeStacks[$name] = new \SplStack();
  270 + }
  271 + $this->scopeStacks[$name]->push($services);
  272 + }
  273 +
  274 + $this->scopedServices[$name] = array();
  275 + }
  276 +
  277 +
  278 + public function leaveScope($name)
  279 + {
  280 + if (!isset($this->scopedServices[$name])) {
  281 + throw new InvalidArgumentException(sprintf('The scope "%s" is not active.', $name));
  282 + }
  283 +
  284 + $services = array($this->services, $this->scopedServices[$name]);
  285 + unset($this->scopedServices[$name]);
  286 + foreach ($this->scopeChildren[$name] as $child) {
  287 + if (!isset($this->scopedServices[$child])) {
  288 + continue;
  289 + }
  290 +
  291 + $services[] = $this->scopedServices[$child];
  292 + unset($this->scopedServices[$child]);
  293 + }
  294 + $this->services = call_user_func_array('array_diff_key', $services);
  295 +
  296 + if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) {
  297 + $services = $this->scopeStacks[$name]->pop();
  298 + $this->scopedServices += $services;
  299 +
  300 + array_unshift($services, $this->services);
  301 + $this->services = call_user_func_array('array_merge', $services);
  302 + }
  303 + }
  304 +
  305 +
  306 + public function addScope(ScopeInterface $scope)
  307 + {
  308 + $name = $scope->getName();
  309 + $parentScope = $scope->getParentName();
  310 +
  311 + if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) {
  312 + throw new InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name));
  313 + }
  314 + if (isset($this->scopes[$name])) {
  315 + throw new InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name));
  316 + }
  317 + if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) {
  318 + throw new InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope));
  319 + }
  320 +
  321 + $this->scopes[$name] = $parentScope;
  322 + $this->scopeChildren[$name] = array();
  323 +
  324 + while ($parentScope !== self::SCOPE_CONTAINER) {
  325 + $this->scopeChildren[$parentScope][] = $name;
  326 + $parentScope = $this->scopes[$parentScope];
  327 + }
  328 + }
  329 +
  330 +
  331 + public function hasScope($name)
  332 + {
  333 + return isset($this->scopes[$name]);
  334 + }
  335 +
  336 +
  337 + public function isScopeActive($name)
  338 + {
  339 + return isset($this->scopedServices[$name]);
  340 + }
  341 +
  342 +
  343 + public static function camelize($id)
  344 + {
  345 + return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id);
  346 + }
  347 +
  348 +
  349 + public static function underscore($id)
  350 + {
  351 + return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.')));
  352 + }
  353 +}
  354 +}
  355 +
  356 +
  357 +
  358 +
  359 +namespace Symfony\Component\HttpKernel
  360 +{
  361 +
  362 +use Symfony\Component\HttpFoundation\Request;
  363 +use Symfony\Component\HttpFoundation\Response;
  364 +
  365 +
  366 +interface HttpKernelInterface
  367 +{
  368 + const MASTER_REQUEST = 1;
  369 + const SUB_REQUEST = 2;
  370 +
  371 +
  372 + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
  373 +}
  374 +}
  375 +
  376 +
  377 +
  378 +
  379 +namespace Symfony\Component\HttpKernel
  380 +{
  381 +
  382 +use Symfony\Component\DependencyInjection\ContainerInterface;
  383 +use Symfony\Component\HttpKernel\HttpKernelInterface;
  384 +use Symfony\Component\HttpKernel\Bundle\BundleInterface;
  385 +use Symfony\Component\Config\Loader\LoaderInterface;
  386 +
  387 +
  388 +interface KernelInterface extends HttpKernelInterface, \Serializable
  389 +{
  390 +
  391 + public function registerBundles();
  392 +
  393 +
  394 + public function registerContainerConfiguration(LoaderInterface $loader);
  395 +
  396 +
  397 + public function boot();
  398 +
  399 +
  400 + public function shutdown();
  401 +
  402 +
  403 + public function getBundles();
  404 +
  405 +
  406 + public function isClassInActiveBundle($class);
  407 +
  408 +
  409 + public function getBundle($name, $first = true);
  410 +
  411 +
  412 + public function locateResource($name, $dir = null, $first = true);
  413 +
  414 +
  415 + public function getName();
  416 +
  417 +
  418 + public function getEnvironment();
  419 +
  420 +
  421 + public function isDebug();
  422 +
  423 +
  424 + public function getRootDir();
  425 +
  426 +
  427 + public function getContainer();
  428 +
  429 +
  430 + public function getStartTime();
  431 +
  432 +
  433 + public function getCacheDir();
  434 +
  435 +
  436 + public function getLogDir();
  437 +
  438 +
  439 + public function getCharset();
  440 +}
  441 +}
  442 +
  443 +
  444 +
  445 +
  446 +namespace Symfony\Component\HttpKernel
  447 +{
  448 +
  449 +use Symfony\Component\HttpFoundation\Request;
  450 +use Symfony\Component\HttpFoundation\Response;
  451 +
  452 +
  453 +interface TerminableInterface
  454 +{
  455 +
  456 + public function terminate(Request $request, Response $response);
  457 +}
  458 +}
  459 +
  460 +
  461 +
  462 +
  463 +namespace Symfony\Component\HttpKernel
  464 +{
  465 +
  466 +use Symfony\Component\DependencyInjection\ContainerInterface;
  467 +use Symfony\Component\DependencyInjection\ContainerBuilder;
  468 +use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
  469 +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  470 +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  471 +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  472 +use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
  473 +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  474 +use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
  475 +use Symfony\Component\HttpFoundation\Request;
  476 +use Symfony\Component\HttpFoundation\Response;
  477 +use Symfony\Component\HttpKernel\HttpKernelInterface;
  478 +use Symfony\Component\HttpKernel\Bundle\BundleInterface;
  479 +use Symfony\Component\HttpKernel\Config\FileLocator;
  480 +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
  481 +use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass;
  482 +use Symfony\Component\HttpKernel\Debug\ErrorHandler;
  483 +use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
  484 +use Symfony\Component\Config\Loader\LoaderResolver;
  485 +use Symfony\Component\Config\Loader\DelegatingLoader;
  486 +use Symfony\Component\Config\ConfigCache;
  487 +use Symfony\Component\ClassLoader\ClassCollectionLoader;