From f517faa071beefe029b963166b2a20b393546e22 Mon Sep 17 00:00:00 2001 From: Emmanuel ROY Date: Wed, 9 Dec 2020 10:26:26 +0100 Subject: [PATCH] update php-cs-fixer --- .gitignore | 1 + application/class/Application.php | 9 +- application/class/Asynchonous.php | 5 +- application/class/Bdd.php | 16 +- application/class/Browser.php | 82 +++-- application/class/Caracter.php | 4 +- application/class/Controlleur.php | 27 +- application/class/ControlleurAction.php | 9 +- application/class/Dispacher.php | 8 +- application/class/Dumper.php | 11 +- application/class/HttpMethod.php | 8 +- application/class/HttpMethodRequete.php | 6 +- application/class/Implement/Action.php | 7 +- application/class/Implement/Conduit.php | 4 +- .../Contrat/HttpReponseInterface.php | 2 +- .../Contrat/RestReponseInterface.php | 2 +- application/class/Implement/HttpReponse.php | 6 +- application/class/Implement/RestReponse.php | 7 +- application/class/Logger.php | 7 +- application/class/Modele.php | 32 +- application/class/Modular.php | 29 +- application/class/ModularRegister.php | 17 +- application/class/Session.php | 29 +- application/class/Tri.php | 9 +- application/class/Url.php | 41 +-- application/class/Vue.php | 29 +- application/class/VueVide.php | 3 - application/config/define-constantes.php | 4 +- application/include/actions/DefaultAction.php | 9 +- application/include/conduits/FooConduit.php | 3 +- application/include/conduits/IndexConduit.php | 3 +- application/include/controlleurs/index.php | 4 +- application/parameters.php | 14 +- application/traitements/ajax-example.php | 18 +- .../traitements/traitement-example.php | 14 +- console/bin.php | 2 +- console/command/Cache.php | 13 +- console/command/Module.php | 158 ++++---- console/command/Page.php | 21 +- console/command/Symfony.php | 10 +- console/skel/module.php | 4 +- console/skel/module_symfony.php | 4 +- console/skel/page.php | 2 +- console/skel/phplist/config.skel.php | 2 +- .../src/Controller/AdminController.php | 1 + .../src/Controller/DefaultController.php | 5 +- .../src/Controller/ErrorController.php | 5 +- .../Events/OnAuthenticationFailureEvent.php | 21 +- .../Events/OnAuthenticationSuccessEvent.php | 18 +- .../src/Security/AccessDeniedHandler.php | 5 +- .../symfony-app/src/Security/AuthUser.php | 14 +- .../src/Security/AuthUserProvider.php | 16 +- .../src/Security/SessionAuthenticator.php | 30 +- .../DependencyInjection/Configuration.php | 37 +- .../SessionAuthExtension.php | 19 +- .../Events/CheckCredentialsEvent.php | 20 +- .../Events/OnAuthenticationFailureEvent.php | 21 +- .../Events/OnAuthenticationSuccessEvent.php | 18 +- .../Security/Abstracts/AuthAbstract.php | 5 +- .../Security/Abstracts/AuthFinal.php | 13 +- .../Security/Abstracts/GetterAbstract.php | 24 +- .../Security/AuthenticatorFactory.php | 8 +- .../AuthBundle/Security/CasAuthenticator.php | 41 ++- .../Security/DefaultAuthentication.php | 24 +- .../Security/Getters/CasAttributes.php | 49 ++- .../Security/Getters/RsaAttributes.php | 51 ++- .../Security/Getters/SessionAttributes.php | 49 ++- .../Interfaces/AttributesInterface.php | 337 +++++++++--------- .../Security/Interfaces/AuthInterface.php | 62 ++-- .../AuthBundle/Security/RsaAuthenticator.php | 40 ++- .../Security/SessionAuthenticator.php | 21 +- .../AuthBundle/Security/User/AuthUser.php | 33 +- .../Security/User/AuthUserProvider.php | 22 +- .../src/Session/AuthBundle/Utils/Config.php | 14 +- console/skel/symfony-app/src/Utils/Config.php | 17 +- .../Adapter/FilesystemTagAwareAdapter.php | 6 +- console/skel/symfony/cache/LockRegistry.php | 7 +- .../skel/symfony/cache/Simple/ArrayCache.php | 4 +- .../symfony/cache/Traits/MemcachedTrait.php | 4 +- .../skel/symfony/cache/Traits/RedisTrait.php | 8 +- .../config/Definition/Builder/ExprBuilder.php | 52 ++- .../symfony/config/Definition/EnumNode.php | 3 +- console/skel/symfony/config/FileLocator.php | 3 +- .../symfony/config/Loader/LoaderInterface.php | 4 +- .../symfony/config/Resource/GlobResource.php | 4 +- .../Definition/Builder/ExprBuilderTest.php | 8 +- .../Dumper/XmlReferenceDumperTest.php | 5 +- .../Tests/Definition/NormalizationTest.php | 12 +- .../config/Tests/Loader/FileLoaderTest.php | 4 +- .../Tests/Loader/LoaderResolverTest.php | 3 +- .../Resource/ClassExistenceResourceTest.php | 4 +- console/skel/symfony/config/Util/XmlUtils.php | 3 +- .../Tests/ExpressionLanguageTest.php | 8 +- .../expression-language/Tests/ParserTest.php | 15 +- .../skel/symfony/filesystem/Filesystem.php | 3 +- .../Finder/Adapter/AbstractFindAdapter.php | 14 +- .../Component/Finder/Shell/Command.php | 4 +- .../Component/Finder/Tests/FinderTest.php | 16 +- .../Iterator/CustomFilterIteratorTest.php | 8 +- .../FilecontentFilterIteratorTest.php | 12 +- .../Tests/Iterator/FilterIteratorTest.php | 5 +- .../Tests/Iterator/IteratorTestCase.php | 16 +- .../Tests/Iterator/MockFileListIterator.php | 4 +- .../Finder/Tests/Iterator/MockSplFileInfo.php | 2 + .../Tests/Iterator/SortableIteratorTest.php | 10 +- .../symfony/http-foundation/File/File.php | 4 +- .../http-foundation/File/UploadedFile.php | 4 +- .../symfony/http-foundation/JsonResponse.php | 4 +- .../http-foundation/RedirectResponse.php | 3 +- .../Tests/File/MimeType/MimeTypeTest.php | 2 +- .../http-foundation/Tests/RequestTest.php | 10 +- .../Session/Flash/AutoExpireFlashBagTest.php | 18 +- .../Tests/Session/Flash/FlashBagTest.php | 18 +- .../Tests/StreamedResponseTest.php | 45 ++- .../skel/symfony/polyfill-ctype/bootstrap.php | 55 ++- .../symfony/polyfill-mbstring/bootstrap.php | 191 ++++++++-- .../skel/symfony/polyfill-php54/bootstrap.php | 15 +- .../skel/symfony/polyfill-php55/bootstrap.php | 20 +- console/skel/symfony/polyfill-php70/Php70.php | 4 +- .../skel/symfony/polyfill-php70/bootstrap.php | 15 +- console/skel/symfony/routing/Router.php | 6 +- .../Tests/Fixtures/CustomXmlFileLoader.php | 4 +- .../Tests/Fixtures/dumper/url_matcher1.php | 79 ++-- .../Tests/Fixtures/dumper/url_matcher2.php | 83 ++--- .../Tests/Fixtures/dumper/url_matcher3.php | 3 +- .../Tests/Fixtures/dumper/url_matcher4.php | 1 - .../Tests/Fixtures/dumper/url_matcher5.php | 12 +- .../Tests/Fixtures/dumper/url_matcher6.php | 32 +- .../Tests/Fixtures/dumper/url_matcher7.php | 32 +- .../Tests/Generator/UrlGeneratorTest.php | 103 ++++-- .../Tests/Loader/ClosureLoaderTest.php | 3 +- .../Tests/Loader/PhpFileLoaderTest.php | 20 +- .../routing/Tests/RouteCollectionTest.php | 41 ++- .../skel/symfony/routing/Tests/RouteTest.php | 4 +- .../Test/ServiceLocatorTest.php | 36 +- .../skel/symfony/yaml/Command/LintCommand.php | 3 +- console/skel/symfony/yaml/Dumper.php | 3 +- public/phpinfo.php | 2 +- tests/Test.php | 36 +- tests/fichiertest.class.php | 19 +- 140 files changed, 1684 insertions(+), 1232 deletions(-) diff --git a/.gitignore b/.gitignore index 5d13a24..e92e44e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ composer.lock vendor .idea +.php_cs.cache diff --git a/application/class/Application.php b/application/class/Application.php index b66cebf..54b2c9e 100644 --- a/application/class/Application.php +++ b/application/class/Application.php @@ -10,7 +10,8 @@ class Application public $route; - public function __construct(){ + public function __construct() + { $this->http = new HttpMethod(); $this->browser = new Browser(); @@ -20,13 +21,13 @@ class Application $this->route = $dispacher->route; } - public function launch(){ + public function launch() + { //print_r($this->route); $controlleur = new Controlleur($this); //si la page n'est un controlleur d'action alors on affiche l'écran - if(!$this->url->page['control']) { + if (!$this->url->page['control']) { print($controlleur->vue->ecran); } } - } diff --git a/application/class/Asynchonous.php b/application/class/Asynchonous.php index f6ff387..8063785 100644 --- a/application/class/Asynchonous.php +++ b/application/class/Asynchonous.php @@ -3,10 +3,8 @@ namespace MVC\Classe; - class Asynchonous { - private $_css; private $_javascript; @@ -37,5 +35,4 @@ class Asynchonous { echo $this->_javascript; } - -} \ No newline at end of file +} diff --git a/application/class/Bdd.php b/application/class/Bdd.php index 9bd0733..5793f6f 100644 --- a/application/class/Bdd.php +++ b/application/class/Bdd.php @@ -8,7 +8,7 @@ class Bdd public function __construct($bdd = 'bdd1') { - switch($bdd) { + switch ($bdd) { case 'bdd1': $this->bdd = new \PDO(DSN_BDD1, USER_BDD1, PASS_BDD1); break; @@ -44,11 +44,12 @@ class Bdd * @param array|null $params * @return bool|\PDOStatement */ - public function faireBindRequete($sql,Array $params = null){ + public function faireBindRequete($sql, array $params = null) + { $req = $this->bdd->prepare($sql); - if($params){ + if ($params) { foreach ($params as $value) { - $req->bindParam($value[0],Caracter::normalise_ChaineDeCaracteres($value[1]),$value[2]); + $req->bindParam($value[0], Caracter::normalise_ChaineDeCaracteres($value[1]), $value[2]); } } $req->execute(); @@ -56,9 +57,10 @@ class Bdd return $req; } - public function exploiterResultat($req){ + public function exploiterResultat($req) + { $res = $req->fetchAll(); - foreach($res as $data) { + foreach ($res as $data) { foreach ($data as $key => $row) { if (is_string($row)) { $row = Caracter::normalise_ChaineDeCaracteres($row); @@ -68,4 +70,4 @@ class Bdd } return $res; } -} \ No newline at end of file +} diff --git a/application/class/Browser.php b/application/class/Browser.php index 2772fc9..b97344d 100644 --- a/application/class/Browser.php +++ b/application/class/Browser.php @@ -3,10 +3,8 @@ namespace MVC\Classe; - class Browser { - public $user; public $userAgent; @@ -29,43 +27,73 @@ class Browser $t = " " . $t; // Humans / Regular Users - if (strpos($t, 'opera') || strpos($t, 'opr/')) return 'Opera'; - elseif (strpos($t, 'edge')) return 'Edge'; - elseif (strpos($t, 'chrome')) return 'Chrome'; - elseif (strpos($t, 'safari')) return 'Safari'; - elseif (strpos($t, 'firefox')) return 'Firefox'; - elseif (strpos($t, 'msie') || strpos($t, 'trident/7')) return 'Internet Explorer'; + if (strpos($t, 'opera') || strpos($t, 'opr/')) { + return 'Opera'; + } elseif (strpos($t, 'edge')) { + return 'Edge'; + } elseif (strpos($t, 'chrome')) { + return 'Chrome'; + } elseif (strpos($t, 'safari')) { + return 'Safari'; + } elseif (strpos($t, 'firefox')) { + return 'Firefox'; + } elseif (strpos($t, 'msie') || strpos($t, 'trident/7')) { + return 'Internet Explorer'; + } // Application Users - elseif (strpos($t, 'curl')) return '[App] Curl'; + elseif (strpos($t, 'curl')) { + return '[App] Curl'; + } // Search Engines - elseif (strpos($t, 'google')) return '[Bot] Googlebot'; - elseif (strpos($t, 'bing')) return '[Bot] Bingbot'; - elseif (strpos($t, 'slurp')) return '[Bot] Yahoo! Slurp'; - elseif (strpos($t, 'duckduckgo')) return '[Bot] DuckDuckBot'; - elseif (strpos($t, 'baidu')) return '[Bot] Baidu'; - elseif (strpos($t, 'yandex')) return '[Bot] Yandex'; - elseif (strpos($t, 'sogou')) return '[Bot] Sogou'; - elseif (strpos($t, 'exabot')) return '[Bot] Exabot'; - elseif (strpos($t, 'msn')) return '[Bot] MSN'; + elseif (strpos($t, 'google')) { + return '[Bot] Googlebot'; + } elseif (strpos($t, 'bing')) { + return '[Bot] Bingbot'; + } elseif (strpos($t, 'slurp')) { + return '[Bot] Yahoo! Slurp'; + } elseif (strpos($t, 'duckduckgo')) { + return '[Bot] DuckDuckBot'; + } elseif (strpos($t, 'baidu')) { + return '[Bot] Baidu'; + } elseif (strpos($t, 'yandex')) { + return '[Bot] Yandex'; + } elseif (strpos($t, 'sogou')) { + return '[Bot] Sogou'; + } elseif (strpos($t, 'exabot')) { + return '[Bot] Exabot'; + } elseif (strpos($t, 'msn')) { + return '[Bot] MSN'; + } // Common Tools and Bots - elseif (strpos($t, 'mj12bot')) return '[Bot] Majestic'; - elseif (strpos($t, 'ahrefs')) return '[Bot] Ahrefs'; - elseif (strpos($t, 'semrush')) return '[Bot] SEMRush'; - elseif (strpos($t, 'rogerbot') || strpos($t, 'dotbot')) return '[Bot] Moz or OpenSiteExplorer'; - elseif (strpos($t, 'frog') || strpos($t, 'screaming')) return '[Bot] Screaming Frog'; + elseif (strpos($t, 'mj12bot')) { + return '[Bot] Majestic'; + } elseif (strpos($t, 'ahrefs')) { + return '[Bot] Ahrefs'; + } elseif (strpos($t, 'semrush')) { + return '[Bot] SEMRush'; + } elseif (strpos($t, 'rogerbot') || strpos($t, 'dotbot')) { + return '[Bot] Moz or OpenSiteExplorer'; + } elseif (strpos($t, 'frog') || strpos($t, 'screaming')) { + return '[Bot] Screaming Frog'; + } // Miscellaneous - elseif (strpos($t, 'facebook')) return '[Bot] Facebook'; - elseif (strpos($t, 'pinterest')) return '[Bot] Pinterest'; + elseif (strpos($t, 'facebook')) { + return '[Bot] Facebook'; + } elseif (strpos($t, 'pinterest')) { + return '[Bot] Pinterest'; + } // Check for strings commonly used in bot user agents elseif (strpos($t, 'crawler') || strpos($t, 'api') || strpos($t, 'spider') || strpos($t, 'http') || strpos($t, 'bot') || strpos($t, 'archive') || - strpos($t, 'info') || strpos($t, 'data')) return '[Bot] Other'; + strpos($t, 'info') || strpos($t, 'data')) { + return '[Bot] Other'; + } return 'Other (Unknown)'; } @@ -90,4 +118,4 @@ class Browser return false; } } -} \ No newline at end of file +} diff --git a/application/class/Caracter.php b/application/class/Caracter.php index 3db6312..623f635 100644 --- a/application/class/Caracter.php +++ b/application/class/Caracter.php @@ -3,12 +3,10 @@ namespace MVC\Classe; - use ForceUTF8\Encoding; class Caracter { - public static function normalise_ChaineDeCaracteres($chaine) { return Encoding::fixUTF8(Caracter::fp_stripslashes($chaine)); @@ -76,4 +74,4 @@ class Caracter $chaine = str_replace('"', '"', $chaine); return $chaine; } -} \ No newline at end of file +} diff --git a/application/class/Controlleur.php b/application/class/Controlleur.php index 5eaa7cc..8d45fbf 100644 --- a/application/class/Controlleur.php +++ b/application/class/Controlleur.php @@ -2,13 +2,13 @@ namespace MVC\Classe; -class Controlleur{ - - public $modele; - public $vue; - - public function __construct($application){ - +class Controlleur +{ + public $modele; + public $vue; + + public function __construct($application) + { switch ($application->http->method) { //cas des requètes PUT et DELETE case 'PUT': @@ -20,8 +20,9 @@ class Controlleur{ $this->callHttpResponse($application); die(); } + // no break default: - if ($application->route != NULL) { + if ($application->route != null) { $conduit = explode('::', $application->route['controller']); require CONDUIT_PATH . DIRECTORY_SEPARATOR . $conduit[0] . '.php'; $conduitRoute = "\\" . $conduit[0]; @@ -30,8 +31,7 @@ class Controlleur{ $class->initialize($application->route); $this->vue = new VueVide(); $this->vue->ecran = $class->$method(); - - } else if ($application->url->page['control']) { + } elseif ($application->url->page['control']) { $url_params = $application->url->page['params']; require TRAITEMENT_PATH . DIRECTORY_SEPARATOR . $application->url->page['name'] . '.php'; } else { @@ -39,9 +39,7 @@ class Controlleur{ $this->vue = new Vue($this); } } - - - } + } public function callHttpResponse($application) { @@ -56,11 +54,10 @@ class Controlleur{ $reponse->instanciate($application->url, $application->http->getData()); $method = strtolower($application->http->method); - Logger::addLog('http11'," $reponseHttp app {$application->http->method} request! ( ".get_class($reponse)."->$method() )"); + Logger::addLog('http11', " $reponseHttp app {$application->http->method} request! ( ".get_class($reponse)."->$method() )"); $this->vue = new VueVide(); $this->vue->ecran = $reponse->$method(); return; } - } diff --git a/application/class/ControlleurAction.php b/application/class/ControlleurAction.php index 8ccdc77..82d7368 100644 --- a/application/class/ControlleurAction.php +++ b/application/class/ControlleurAction.php @@ -3,10 +3,8 @@ namespace MVC\Classe; - class ControlleurAction { - public static function inserer($action, $data = array()) { $action = explode('.', $action); @@ -21,13 +19,8 @@ class ControlleurAction } else { return $slot->default($data); } - } else { /*HandleError*/ } - - } - - -} \ No newline at end of file +} diff --git a/application/class/Dispacher.php b/application/class/Dispacher.php index 8ac87d1..5a32e9a 100644 --- a/application/class/Dispacher.php +++ b/application/class/Dispacher.php @@ -9,10 +9,8 @@ use Symfony\Component\Routing\RequestContext as RequestContext; use Symfony\Component\Routing\Loader\YamlFileLoader as YamlFileLoader; use Symfony\Component\Routing\Exception\ResourceNotFoundException; - class Dispacher { - public $route; public function __construct() @@ -20,7 +18,7 @@ class Dispacher //Avoid callback from empty homepage if ($_SERVER['REQUEST_URI'] == '/' || $_SERVER['REQUEST_URI'] == '') { - $this->route = NULL; + $this->route = null; } else { //Test the route from config file try { @@ -38,8 +36,8 @@ class Dispacher $this->route = $parameters; } catch (ResourceNotFoundException $e) { - $this->route = NULL; + $this->route = null; } } } -} \ No newline at end of file +} diff --git a/application/class/Dumper.php b/application/class/Dumper.php index 87dcfd0..e31c80d 100644 --- a/application/class/Dumper.php +++ b/application/class/Dumper.php @@ -2,10 +2,10 @@ namespace MVC\Classe; - -class Dumper{ - - public static function dump($var){ +class Dumper +{ + public static function dump($var) + { echo "
";
         if (is_bool($var)) {
             echo ($var) ? "true" : "false";
@@ -21,7 +21,6 @@ class Dumper{
      */
     public static function setPHPvalues()
     {
-
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
         ini_set('memory_limit', -1);
@@ -32,4 +31,4 @@ class Dumper{
 
         return;
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/HttpMethod.php b/application/class/HttpMethod.php
index 20ab3e0..3413484 100644
--- a/application/class/HttpMethod.php
+++ b/application/class/HttpMethod.php
@@ -3,17 +3,15 @@
 
 namespace MVC\Classe;
 
-
 class HttpMethod
 {
-
     public $method;
     protected $data;
 
     public function __construct()
     {
         $this->method = $_SERVER['REQUEST_METHOD'];
-        Logger::addLog('http.method',$this->method);
+        Logger::addLog('http.method', $this->method);
         $this->acceptResponse();
     }
 
@@ -28,6 +26,7 @@ class HttpMethod
                 //$this->data['GET'] = ...
                 //POST DATA except enctype="multipart/form-data"
                 $this->data = json_decode(file_get_contents("php://input"), true);
+                // no break
             case 'DELETE':
                 //$this->data['GET'] = ...
                 //POST DATA except enctype="multipart/form-data"
@@ -44,5 +43,4 @@ class HttpMethod
     {
         return $this->data;
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/class/HttpMethodRequete.php b/application/class/HttpMethodRequete.php
index 513c463..284f446 100644
--- a/application/class/HttpMethodRequete.php
+++ b/application/class/HttpMethodRequete.php
@@ -3,7 +3,6 @@
 
 namespace MVC\Classe;
 
-
 /**
  * Class Response
  *
@@ -165,8 +164,6 @@ class HttpMethodRequete
 
         /** Pour utiliser ce code il faut mettre la variable safe_mode a ON dans php.ini */
         //exec($curl_cmd);
-
-
     }
 
     /**
@@ -218,5 +215,4 @@ class HttpMethodRequete
     {
         return $this->replaceContext('DELETE')->addContent($params)->send();
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/Action.php b/application/class/Implement/Action.php
index 0c3c415..5c74b35 100644
--- a/application/class/Implement/Action.php
+++ b/application/class/Implement/Action.php
@@ -3,14 +3,10 @@
 
 namespace MVC\Classe\Implement;
 
-
-
 class Action
 {
     public function render($view, $data)
     {
-
-
         $paths = new \SplPriorityQueue;
 
         $paths->insert(VIEW_PATH . DIRECTORY_SEPARATOR . "system", 100);
@@ -20,6 +16,5 @@ class Action
         $renderer = new \Windwalker\Renderer\BladeRenderer($paths, array('cache_path' => VIEW_PATH . DIRECTORY_SEPARATOR . "cache"));
 
         return $renderer->render($view, $data);
-
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/Conduit.php b/application/class/Implement/Conduit.php
index cc63e1f..165c471 100644
--- a/application/class/Implement/Conduit.php
+++ b/application/class/Implement/Conduit.php
@@ -3,14 +3,12 @@
 
 namespace MVC\Classe\Implement;
 
-
 class Conduit extends Action
 {
     public function initialize($var)
     {
         //Export variable from conduit
         foreach ($var as $key => $value) {
-
             if ($key != "controller") {
                 if ($key != "_route") {
                     $this->$key = $value;
@@ -19,4 +17,4 @@ class Conduit extends Action
         }
         return;
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/Contrat/HttpReponseInterface.php b/application/class/Implement/Contrat/HttpReponseInterface.php
index edd3daa..0a40755 100644
--- a/application/class/Implement/Contrat/HttpReponseInterface.php
+++ b/application/class/Implement/Contrat/HttpReponseInterface.php
@@ -7,4 +7,4 @@ interface HttpReponseInterface
     public function put();
 
     public function delete();
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/Contrat/RestReponseInterface.php b/application/class/Implement/Contrat/RestReponseInterface.php
index e59e93c..2f9586f 100644
--- a/application/class/Implement/Contrat/RestReponseInterface.php
+++ b/application/class/Implement/Contrat/RestReponseInterface.php
@@ -11,4 +11,4 @@ interface RestReponseInterface
     public function put();
 
     public function delete();
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/HttpReponse.php b/application/class/Implement/HttpReponse.php
index 653a20c..0bc2b5c 100644
--- a/application/class/Implement/HttpReponse.php
+++ b/application/class/Implement/HttpReponse.php
@@ -7,7 +7,6 @@ use MVC\Classe\Implement\Contrat\HttpReponseInterface;
 
 class HttpReponse extends Action implements HttpReponseInterface
 {
-
     public $url;
     public $params;
     public $data;
@@ -35,12 +34,9 @@ class HttpReponse extends Action implements HttpReponseInterface
 
     public function put()
     {
-
     }
 
     public function delete()
     {
-
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/class/Implement/RestReponse.php b/application/class/Implement/RestReponse.php
index b2a495c..350422f 100644
--- a/application/class/Implement/RestReponse.php
+++ b/application/class/Implement/RestReponse.php
@@ -10,7 +10,6 @@ use MVC\Classe\Implement\Contrat\RestReponseInterface;
 
 class RestReponse implements RestReponseInterface
 {
-
     public $url;
     public $params;
     public $data;
@@ -38,21 +37,17 @@ class RestReponse implements RestReponseInterface
 
     public function get()
     {
-
     }
 
     public function post()
     {
-
     }
 
     public function put()
     {
-
     }
 
     public function delete()
     {
-
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/Logger.php b/application/class/Logger.php
index aa05216..81a1365 100644
--- a/application/class/Logger.php
+++ b/application/class/Logger.php
@@ -3,13 +3,11 @@
 
 namespace MVC\Classe;
 
-
 use Symfony\Component\Validator\Constraints\Date;
 
 class Logger
 {
-
-    static function addLog($type = 'default', $what = "")
+    public static function addLog($type = 'default', $what = "")
     {
         $file = LOG_PATH . DIRECTORY_SEPARATOR . 'app.' . $type . '.log';
         $browser = new Browser();
@@ -41,5 +39,4 @@ class Logger
 
         return;
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/class/Modele.php b/application/class/Modele.php
index 43ef1d5..140dc22 100644
--- a/application/class/Modele.php
+++ b/application/class/Modele.php
@@ -2,15 +2,15 @@
 
 namespace MVC\Classe;
 
-class Modele{
-	
-	public $page;
-	
-	public function __construct($base_param){
-		
-		if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')){
-			$fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model');
-			foreach ($fichier as $ligne_num => $ligne) {
+class Modele
+{
+    public $page;
+    
+    public function __construct($base_param)
+    {
+        if (file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')) {
+            $fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model');
+            foreach ($fichier as $ligne_num => $ligne) {
                 //on recherche le pattern des parametres
                 if (preg_match("#[ ]*([a-zA-Z_+]*)[ ]*[:][ ]*([a-zA-Z0-9-_+'\{\,\ \}\(\)]*[ ]*)#", $ligne, $matches)) {
                     //on recherche le pattern des tableau dans la valeur du paramètre
@@ -28,14 +28,12 @@ class Modele{
                     }
                     $this->page[$matches[1]] = $matches[2];
                 }
-
             }
             $this->page['url_params'] = $base_param['params'];
-		}else{
-			$this->page['name'] = $base_param['name'];
-			$this->page['description'] = $base_param['description'];
-			$this->page['params'] = $base_param['params'];
-		}
-	}
-	
+        } else {
+            $this->page['name'] = $base_param['name'];
+            $this->page['description'] = $base_param['description'];
+            $this->page['params'] = $base_param['params'];
+        }
+    }
 }
diff --git a/application/class/Modular.php b/application/class/Modular.php
index fe2c8a4..e5f28d1 100644
--- a/application/class/Modular.php
+++ b/application/class/Modular.php
@@ -2,13 +2,14 @@
 
 namespace MVC\Classe;
 
-class Modular{
-
+class Modular
+{
     private $app = "";
     private $subapp_dir = "";
     private $subfile = "index.php";
 
-    public function  __construct($appName,$type = 'symfony',$options = array()){
+    public function __construct($appName, $type = 'symfony', $options = array())
+    {
 
         //Dumper::dump($options);die();
 
@@ -17,18 +18,18 @@ class Modular{
             case "symfony":
                 break;
             case "wordpress":
-                if(isset($options[0])) {
+                if (isset($options[0])) {
                     switch ($options[0]) {
                         case 'wp-admin':
                             $this->subapp_dir = DIRECTORY_SEPARATOR . $options[0];
-                            if(isset($options[1])) {
+                            if (isset($options[1])) {
                                 switch ($options[1]) {
                                     case 'setup-config.php':
                                     case 'install.php':
                                         $this->subfile = $options[1];
                                         break;
                                     default:
-                                        if(preg_match('#(.)*\.php#',$options[1])){
+                                        if (preg_match('#(.)*\.php#', $options[1])) {
                                             $this->subfile = $options[1];
                                         }
                                 }
@@ -42,7 +43,7 @@ class Modular{
                 }
                 break;
             case "prestashop":
-                if(isset($options[0])) {
+                if (isset($options[0])) {
                     switch ($options[0]) {
                         case 'admin-dev':
                         case 'install-dev':
@@ -53,20 +54,20 @@ class Modular{
                 }
                 break;
             case "phplist":
-                if(isset($options[0])) {
+                if (isset($options[0])) {
                     switch ($options[0]) {
                         case 'admin':
                             $this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists'. DIRECTORY_SEPARATOR . $options[0] ;
                             break;
                         default:
                     }
-                }else{
+                } else {
                     $this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists';
                 }
                 break;
             case "wanewsletter":
                 $this->subfile = "install.php";
-                if(isset($options[0])) {
+                if (isset($options[0])) {
                     switch ($options[0]) {
                         case 'admin':
                             $this->subapp_dir = DIRECTORY_SEPARATOR . $options[0] ;
@@ -82,11 +83,13 @@ class Modular{
         }
     }
 
-    public function getAppName(){
+    public function getAppName()
+    {
         return $this->app;
     }
 
-    public function load($type = "symfony"){
+    public function load($type = "symfony")
+    {
         switch ($type) {
             case "symfony":
             require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . DIRECTORY_SEPARATOR . "public" . DIRECTORY_SEPARATOR . "index.php";
@@ -108,4 +111,4 @@ class Modular{
                 break;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/ModularRegister.php b/application/class/ModularRegister.php
index 58c3e9d..12589b3 100644
--- a/application/class/ModularRegister.php
+++ b/application/class/ModularRegister.php
@@ -2,28 +2,29 @@
 
 namespace MVC\Classe;
 
-class ModularRegister{
-
+class ModularRegister
+{
     public $registry = array();
     public $index = array();
 
-    public function __construct(){
-
+    public function __construct()
+    {
         $fichier = file(MODULES_PATH . DIRECTORY_SEPARATOR . "setup" . DIRECTORY_SEPARATOR ."registre.model");
         foreach ($fichier as $ligne_num => $ligne) {
             if (preg_match("#([ ]*[a-zA-Z0-9-_+éèàùïîç]*)[ ]*[:][ ]*([0-9a-zA-Z-_+ 'éèàùïîç.]*[ ]*)#", $ligne, $matches)) {
-
                 $this->registry[$matches[1]] = $matches[2];
                 $this->index[] = $matches[1];
             }
         }
     }
 
-    public function getRegistre(){
+    public function getRegistre()
+    {
         return $this->registry;
     }
 
-    public function getIndex(){
+    public function getIndex()
+    {
         return $this->index;
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/Session.php b/application/class/Session.php
index beab2c1..ba2e768 100644
--- a/application/class/Session.php
+++ b/application/class/Session.php
@@ -3,64 +3,62 @@
 
 namespace MVC\Classe;
 
-
 class Session
 {
-
-    static public function start()
+    public static function start()
     {
         session_start();
         return;
     }
-    static public function destroy()
+    public static function destroy()
     {
         session_destroy();
         return;
     }
 
-    static public function setUserProfile($userProfile)
+    public static function setUserProfile($userProfile)
     {
         $_SESSION['userProfile'] = $userProfile;
         return;
     }
-    static public function setId($id)
+    public static function setId($id)
     {
         $_SESSION['id'] = $id;
         return;
     }
-    static public function setUserName($username)
+    public static function setUserName($username)
     {
         $_SESSION['username'] = $username;
         return;
     }
 
-    static public function setToken($token)
+    public static function setToken($token)
     {
         $_SESSION['userToken'] = $token;
         return;
     }
 
-    static public function setStorage($hybriauthStorage)
+    public static function setStorage($hybriauthStorage)
     {
         $_SESSION['storage'] = $hybriauthStorage;
         return;
     }
-    static public function getStorage()
+    public static function getStorage()
     {
         return $_SESSION['storage'] ;
     }
 
-    static public function setHybridAuth($hybriauth)
+    public static function setHybridAuth($hybriauth)
     {
         $_SESSION['auth'] = $hybriauth;
         return;
     }
-    static public function getHybridAuth()
+    public static function getHybridAuth()
     {
         return $_SESSION['auth'] ;
     }
 
-    static public function isRegistered()
+    public static function isRegistered()
     {
         if (isset($_SESSION['userProfile'])) {
             return true;
@@ -69,7 +67,7 @@ class Session
         }
     }
 
-    static public function redirectIfNotRegistered()
+    public static function redirectIfNotRegistered()
     {
         if (isset($_SESSION['userProfile'])) {
             return ;
@@ -78,5 +76,4 @@ class Session
             die('Ooops, something was wrong...');
         }
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/class/Tri.php b/application/class/Tri.php
index 75b3278..874407b 100644
--- a/application/class/Tri.php
+++ b/application/class/Tri.php
@@ -2,12 +2,13 @@
 
 namespace MVC\Classe;
 
-class Tri{
-
-    public static function cmp($a,$b){
+class Tri
+{
+    public static function cmp($a, $b)
+    {
         if ($a == $b) {
             return 0;
         }
         return ($a < $b) ? -1 : 1;
     }
-}
\ No newline at end of file
+}
diff --git a/application/class/Url.php b/application/class/Url.php
index cafb4a9..3d8a81c 100644
--- a/application/class/Url.php
+++ b/application/class/Url.php
@@ -26,37 +26,36 @@ class Url
 
 
         $url = parse_url($_SERVER['REQUEST_URI']);
-        $urlTrim = trim( $url['path'] , '/' );
-        $urlParts = explode('/' , $urlTrim );
+        $urlTrim = trim($url['path'], '/');
+        $urlParts = explode('/', $urlTrim);
 
         //print_r($urlParts);
-        if(isset($urlParts[0])) {
+        if (isset($urlParts[0])) {
             //Récupération du nom de la page
             ($urlParts[0] == 'index' || $urlParts[0] == '') ? $page['name'] = 'index' : $page['name'] = $urlParts[0];
             unset($urlParts[0]);
-        }else{
+        } else {
             $page['name'] = 'index';
         }
 
         //il se peut que l'on ait des variable avec ? dans l'url
-        $urlQuery = explode('?' , $page['name'] );
+        $urlQuery = explode('?', $page['name']);
         $page['name'] = $urlQuery[0];
 
         $page['name'] = strtolower($page['name']);
 
-        if($page['name'] == 'control'){
+        if ($page['name'] == 'control') {
             $page['control'] = true;
-            ($urlParts[1] == 'index' || $urlParts[1] == '' ) ? $page['name']='index' : $page['name']=$urlParts[1];
+            ($urlParts[1] == 'index' || $urlParts[1] == '') ? $page['name']='index' : $page['name']=$urlParts[1];
             unset($urlParts[1]);
-
         }
 
         //vérification du nombre de parametres:
         $numParts = count($urlParts);
         //s'il n'existe pas autant de clé que de valeurs, ce peut ^etre un module symfony
-        if ( $numParts%2 != 0 ) {
+        if ($numParts%2 != 0) {
             //si un module symfony n'est pas reférencé avec le nom de la page, on renvoi un erreur
-            if( !in_array($page['name'], $this->registre->getIndex()) ){
+            if (!in_array($page['name'], $this->registre->getIndex())) {
                 $page['name'] = 'error';
                 $page['params'] = array();
                 $this->page = $page;
@@ -70,9 +69,9 @@ class Url
             }
 
             //cas d'utilisation normal : il existe autant de clé que de valeurs
-        } else if ( $numParts != 0 ) {
+        } elseif ($numParts != 0) {
             // si c'est un module alors on charge un a un les parametres
-            if( in_array($page['name'], $this->registre->getIndex()) ){
+            if (in_array($page['name'], $this->registre->getIndex())) {
                 foreach ($urlParts as $key => $value) {
                     $values[] = $value;
                     $keys[] = $key;
@@ -99,9 +98,9 @@ class Url
         $page['name'] = lcfirst($page['name']);
         $pageFile = CONTROLLERS_PATH . DIRECTORY_SEPARATOR . $page['name'] . '.php';
         //verification de l'existence de la page dans les controlleurs
-        if($page['control']){
+        if ($page['control']) {
             $pageFile = TRAITEMENT_PATH . DIRECTORY_SEPARATOR . $page['name'] . '.php';
-        }else {
+        } else {
             //recherche du fichier controlleur correpondant HTTP1.1 ou HTTP1.0
             switch ($method) {
                 //cas des requètes HTTP1.1
@@ -132,10 +131,9 @@ class Url
         }
         $this->page = $page;
         $this->pageFile = $pageFile;
-
     }
 
-    static public function link_rewrite($isControlPatern, $page, $params = array())
+    public static function link_rewrite($isControlPatern, $page, $params = array())
     {
         if ($isControlPatern) {
             return self::controlLink_rewrite($page, $params);
@@ -144,7 +142,7 @@ class Url
         }
     }
 
-    static public function module_link_rewrite($page, $params = array())
+    public static function module_link_rewrite($page, $params = array())
     {
         $stringParams = '';
         foreach ($params as $values) {
@@ -153,17 +151,16 @@ class Url
         return '/' . $page . $stringParams;
     }
 
-    static private function link_rewrite_slashParam($page, $params = array())
+    private static function link_rewrite_slashParam($page, $params = array())
     {
         $stringParams = '';
         foreach ($params as $key => $values) {
             $stringParams .= "/" . $key . "/" . $values;
         }
         return '/' . $page . $stringParams;
-
     }
 
-    static private function controlLink_rewrite($page, $params = array())
+    private static function controlLink_rewrite($page, $params = array())
     {
         $stringParams = '';
         foreach ($params as $key => $values) {
@@ -172,7 +169,7 @@ class Url
         return '/' . 'control' . '/' . $page . $stringParams;
     }
 
-    static public function absolute_link_rewrite($isControlPatern, $page, $params = array())
+    public static function absolute_link_rewrite($isControlPatern, $page, $params = array())
     {
         $url = $_SERVER['HTTP_HOST'];
         if ($isControlPatern) {
@@ -187,7 +184,5 @@ class Url
         }
 
         return ($scheme . "://" . $url . $uri);
-
     }
-
 }
diff --git a/application/class/Vue.php b/application/class/Vue.php
index e406ece..f3faa1b 100644
--- a/application/class/Vue.php
+++ b/application/class/Vue.php
@@ -2,25 +2,25 @@
 
 namespace MVC\Classe;
 
-class Vue{
-	
-	public $ecran;
-	public $block_body;
-	
-	public function __construct($application){
-
+class Vue
+{
+    public $ecran;
+    public $block_body;
+    
+    public function __construct($application)
+    {
         $templateData = array();
-		extract( $application->modele->page );
+        extract($application->modele->page);
 
-		ob_start();
-		if(file_exists(VIEW_PATH.DIRECTORY_SEPARATOR."view".DIRECTORY_SEPARATOR.$name.".blade.php")) {
+        ob_start();
+        if (file_exists(VIEW_PATH.DIRECTORY_SEPARATOR."view".DIRECTORY_SEPARATOR.$name.".blade.php")) {
 
             //l'inclusion du controlleur doit renvoyer le tableau $templateData
             require CONTROLLER_PATH . DIRECTORY_SEPARATOR . $name . '.php';
 
 
 
-		    //TEMPLATING BLADE
+            //TEMPLATING BLADE
             $paths = new \SplPriorityQueue;
 
             $paths->insert(VIEW_PATH . DIRECTORY_SEPARATOR . "system", 100);
@@ -34,12 +34,9 @@ class Vue{
                 $templateData[$key] = $value;
             }
             echo $renderer->render($name, $templateData);
-
-        }else{
+        } else {
             include CONTROLLER_PATH . DIRECTORY_SEPARATOR . $name . '.php';
         }
         $this->ecran = ob_get_clean();
-
-	}
-	
+    }
 }
diff --git a/application/class/VueVide.php b/application/class/VueVide.php
index 29547b0..e392203 100644
--- a/application/class/VueVide.php
+++ b/application/class/VueVide.php
@@ -2,14 +2,11 @@
 
 namespace MVC\Classe;
 
-
 class VueVide
 {
-
     public $ecran;
 
     public function __construct()
     {
     }
-
 }
diff --git a/application/config/define-constantes.php b/application/config/define-constantes.php
index 5e93ae0..8cd861f 100644
--- a/application/config/define-constantes.php
+++ b/application/config/define-constantes.php
@@ -5,7 +5,7 @@ define("CONDUIT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRE
 define("CONTROLLERS_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs");
 define("CONFIG_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "config");
 define("LOG_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "logs");
-define("LAYOUT_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout");
+define("LAYOUT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout");
 define("ACTION_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "actions");
 define("MODELS_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "modeles");
 define("VIEW_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "vues");
@@ -13,4 +13,4 @@ define("CONTROLLER_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . D
 define("TRAITEMENT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements");
 define("PUBLIC_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "public");
 define("CONSOLE_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "console");
-define("DATA_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "data");
\ No newline at end of file
+define("DATA_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "data");
diff --git a/application/include/actions/DefaultAction.php b/application/include/actions/DefaultAction.php
index 1b8a237..c7447d8 100644
--- a/application/include/actions/DefaultAction.php
+++ b/application/include/actions/DefaultAction.php
@@ -55,14 +55,13 @@ class DefaultAction extends Action
 
     public function makeHttp11($data)
     {
-
         $data = array('myval' => 25);
         //Dumper::dump($data);
-        \MVC\Classe\Logger::addLog('action','http11 make request');
+        \MVC\Classe\Logger::addLog('action', 'http11 make request');
         $request = new HttpMethodRequete();
-        $request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->get($data);
-        $request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->post($data);
+        $request->setUrl(Url::absolute_link_rewrite(false, 'accueil', ['var10'=>'val10']))->get($data);
+        $request->setUrl(Url::absolute_link_rewrite(false, 'accueil', ['var10'=>'val10']))->post($data);
         $request->setUrl(Url::absolute_link_rewrite(false, 'accueil', ['var10' => 'val10']))->put($data);
-        $request->setUrl(Url::absolute_link_rewrite(false,'accueil',['var10'=>'val10']))->delete($data);
+        $request->setUrl(Url::absolute_link_rewrite(false, 'accueil', ['var10'=>'val10']))->delete($data);
     }
 }
diff --git a/application/include/conduits/FooConduit.php b/application/include/conduits/FooConduit.php
index 5d76449..dcefa6b 100644
--- a/application/include/conduits/FooConduit.php
+++ b/application/include/conduits/FooConduit.php
@@ -17,6 +17,5 @@ class FooConduit extends Conduit
     {
         echo "load of foo";
         return $this->render('foo', array('page_title' => 'Foo', 'description' => 'FooConduit', 'id' => $this->id));
-
     }
-}
\ No newline at end of file
+}
diff --git a/application/include/conduits/IndexConduit.php b/application/include/conduits/IndexConduit.php
index 1c62f36..2dbe1e5 100644
--- a/application/include/conduits/IndexConduit.php
+++ b/application/include/conduits/IndexConduit.php
@@ -11,5 +11,4 @@ class IndexConduit extends Conduit
         echo "IndexControlleur";
         return $this->render('index', array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge'));
     }
-
-}
\ No newline at end of file
+}
diff --git a/application/include/controlleurs/index.php b/application/include/controlleurs/index.php
index 1f42b82..99b7d9b 100644
--- a/application/include/controlleurs/index.php
+++ b/application/include/controlleurs/index.php
@@ -6,7 +6,7 @@ use MVC\Classe\Logger;
 
 //Dumper::dump($_SESSION);
 
-\MVC\Classe\ControlleurAction::inserer('default.makeHttp11',[]);
+\MVC\Classe\ControlleurAction::inserer('default.makeHttp11', []);
 
 $templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge');
-Logger::addLog('ok', 'Hello world');
\ No newline at end of file
+Logger::addLog('ok', 'Hello world');
diff --git a/application/parameters.php b/application/parameters.php
index d86fad6..ab11cff 100644
--- a/application/parameters.php
+++ b/application/parameters.php
@@ -5,12 +5,12 @@ define('DSN_BDD_DEFAULT', "mysql:host=localhost;dbname=default");
 define('USER_BDD_DEFAULT', "user_default");
 define('PASS_BDD_DEFAULT', "pass_default");
 
-define('DSN_BDD1',"mysql:host=localhost;dbname=db1");
-define('USER_BDD1',"user1");
-define('PASS_BDD1',"pass1");
+define('DSN_BDD1', "mysql:host=localhost;dbname=db1");
+define('USER_BDD1', "user1");
+define('PASS_BDD1', "pass1");
 
-define('DSN_BDD2',"mysql:host=localhost;dbname=db2");
-define('USER_BDD2',"user2");
-define('PASS_BDD2',"pass2");
+define('DSN_BDD2', "mysql:host=localhost;dbname=db2");
+define('USER_BDD2', "user2");
+define('PASS_BDD2', "pass2");
 
-define('PATH_URL',$_SERVER['REQUEST_SCHEME'] . "://www.sand-framework.infoartsmedia.org");
\ No newline at end of file
+define('PATH_URL', $_SERVER['REQUEST_SCHEME'] . "://www.sand-framework.infoartsmedia.org");
diff --git a/application/traitements/ajax-example.php b/application/traitements/ajax-example.php
index 7940182..8a8a0a6 100644
--- a/application/traitements/ajax-example.php
+++ b/application/traitements/ajax-example.php
@@ -3,34 +3,34 @@
 header("Content-Type: text/plain");
 
 $bdd = new Bdd();
-$dns = \MVC\Domain\Dns::getDNS($bdd,$url_params['ip']);
+$dns = \MVC\Domain\Dns::getDNS($bdd, $url_params['ip']);
 $alias = array();
-$reverseDns = \MVC\Domain\Dns::getReverseDNS($bdd,$url_params['ip']);
-foreach($reverseDns as $row){
-    $tab = \MVC\Domain\Dns::getAliasFromDNS($bdd,$row['valeur2_dns']);
+$reverseDns = \MVC\Domain\Dns::getReverseDNS($bdd, $url_params['ip']);
+foreach ($reverseDns as $row) {
+    $tab = \MVC\Domain\Dns::getAliasFromDNS($bdd, $row['valeur2_dns']);
     $alias[] = $tab;
 }
 
 //Affichage
 echo "

DNS :


"; -foreach($dns as $row){ +foreach ($dns as $row) { echo $row['valeur1_dns']; echo "
"; } echo "
"; echo "

Reverse DNS :


"; -foreach($reverseDns as $row){ +foreach ($reverseDns as $row) { echo $row['valeur2_dns']; echo "
"; } echo "
"; echo "

Alias :


"; -if(isset($alias[0][0]['valeur1_dns'])) { - foreach($alias as $rAlias){ +if (isset($alias[0][0]['valeur1_dns'])) { + foreach ($alias as $rAlias) { foreach ($rAlias as $row) { echo $row['valeur1_dns']; echo "
"; } } -} \ No newline at end of file +} diff --git a/application/traitements/traitement-example.php b/application/traitements/traitement-example.php index 2b0f9c8..9b8d939 100644 --- a/application/traitements/traitement-example.php +++ b/application/traitements/traitement-example.php @@ -3,17 +3,17 @@ $path = PATH_URL; $bdd = new \MVC\Classe\Bdd(); -\MVC\Domain\Host::addHost($bdd,$_POST['ip'],$_POST['nom']); +\MVC\Domain\Host::addHost($bdd, $_POST['ip'], $_POST['nom']); -switch($_POST['from']){ - case "vlan-zone+" : - case "vlan-zone" : +switch ($_POST['from']) { + case "vlan-zone+": + case "vlan-zone": header("Location: $path{$_POST['from']}/vlan/{$_POST['vlan']}/alert/2/host/{$_POST['ip']}"); break; - case "ip-zone+" : - case "ip-zone" : + case "ip-zone+": + case "ip-zone": header("Location: $path{$_POST['from']}/motif-ip/{$_POST['motif-ip']}/alert/2/host/{$_POST['ip']}"); break; default: header("Location: $path"); -} \ No newline at end of file +} diff --git a/console/bin.php b/console/bin.php index 0ca8caa..d629947 100644 --- a/console/bin.php +++ b/console/bin.php @@ -24,4 +24,4 @@ if (isset($argv[1])) { } } else { print "No command was specified !\n"; -} \ No newline at end of file +} diff --git a/console/command/Cache.php b/console/command/Cache.php index 4504fe2..94cea1b 100644 --- a/console/command/Cache.php +++ b/console/command/Cache.php @@ -4,12 +4,13 @@ namespace MVC\Command; class Cache { - - static public function help(){ + public static function help() + { print "explaination of the command\n\n"; } - static public function clear(){ + public static function clear() + { $git_cache_rm = system('rm -f '.VIEW_PATH.'/cache/*', $git_cache_rm_retval); print $git_cache_rm_retval; $git_logs_rm = system('rm -f '.LOG_PATH.'/*', $git_logs_rm_retval); @@ -18,10 +19,10 @@ class Cache print "logs && cache cleared ! \n\n"; } - static public function stabilize(){ + public static function stabilize() + { $git_cache_rm = system('rm -f '.VIEW_PATH.'/cache/*', $git_cache_rm_retval); print $git_cache_rm_retval; print "cache stabilized ! \n\n"; } - -} \ No newline at end of file +} diff --git a/console/command/Module.php b/console/command/Module.php index ea1de54..ef11e95 100644 --- a/console/command/Module.php +++ b/console/command/Module.php @@ -4,66 +4,68 @@ namespace MVC\Command; class Module { - static public function help(){ + public static function help() + { print "explaination of the command\n\n"; } - static public function add(){ + public static function add() + { print "adding module...\n\n"; print "Quel est le module a ajouter ?\n1.Symfony\n2.Wordpress\n3.Prestashop\n4.PhpList\n5.Wanewsletter\n6.PHPmyNewletter\n>"; $module = trim(fgets(STDIN)); - switch($module){ + switch ($module) { case 1: print "Quel est le nom du module symfony à ajouter (default : symfony) ? "; $name = trim(fgets(STDIN)); - if($name !== '' && preg_match('#(.)+#',$name)){ + if ($name !== '' && preg_match('#(.)+#', $name)) { Module::addSymfony($name); - }else{ + } else { Module::addSymfony('symfony'); } break; case 2: print "Quel est la version de Wordpress à ajouter (default : 5.4) ? "; $version = trim(fgets(STDIN)); - if($version !== '' && preg_match('#(.)\.(.)#',$version)){ + if ($version !== '' && preg_match('#(.)\.(.)#', $version)) { Module::addWordpress($version); - }else{ + } else { Module::addWordpress('5.4'); } break; case 3: print "Quel est la version de Prestashop à ajouter (default : 1.7.5.0) ? "; $version = trim(fgets(STDIN)); - if($version !== '' && preg_match('#(.)\.(.)\.(.)\.(.)#',$version)){ + if ($version !== '' && preg_match('#(.)\.(.)\.(.)\.(.)#', $version)) { Module::addPrestashop($version); - }else{ + } else { Module::addPrestashop('1.7.5.0'); } break; case 4: print "Quel est la version de PhpList à ajouter (default : 3.5.2) ? "; $version = trim(fgets(STDIN)); - if($version !== '' && preg_match('#(.)\.(.)\.(.)#',$version)){ + if ($version !== '' && preg_match('#(.)\.(.)\.(.)#', $version)) { Module::addPhplist($version); - }else{ + } else { Module::addPhplist('3.5.2'); } break; case 5: print "Quel est la version de Wanewletter à ajouter (default : release-3.0.1) ? "; $version = trim(fgets(STDIN)); - if($version !== '' && preg_match('#(.)\.(.)\.(.)#',$version)){ + if ($version !== '' && preg_match('#(.)\.(.)\.(.)#', $version)) { Module::addWanewsletter($version); - }else{ + } else { Module::addWanewsletter('release-3.0.1'); } break; case 6: print "Quel est la version de PHPmyNewletter à ajouter (default : v2.0.5) ? "; $version = trim(fgets(STDIN)); - if($version !== '' && preg_match('#(.)\.(.)\.(.)#',$version)){ + if ($version !== '' && preg_match('#(.)\.(.)\.(.)#', $version)) { Module::addPHPMyNewsletter($version); - }else{ + } else { Module::addPHPMyNewsletter('v2.0.5'); } break; @@ -71,17 +73,18 @@ class Module } } - static public function remove(){ + public static function remove() + { print "removing module...\n\n"; print "Quel est le module a supprimer?\n1.Symfony\n2.Wordpress\n3.Prestashop\n4.PhpList\n5.Wanewsletter\n6.PHPmyNewletter\n>"; $module = trim(fgets(STDIN)); - switch($module){ + switch ($module) { case 1: print "Quel est le nom du module symfony à supprimer (default : symfony) ? "; $name = trim(fgets(STDIN)); - if($name !== '' && preg_match('#(.)+#',$name)){ + if ($name !== '' && preg_match('#(.)+#', $name)) { Module::removeSymfony($name); - }else{ + } else { Module::removeSymfony('symfony'); } break; @@ -104,8 +107,8 @@ class Module } } - static private function addSymfony($name = 'symfony'){ - + private static function addSymfony($name = 'symfony') + { $git_clone = shell_exec('cd '.MODULES_PATH.' && composer create-project symfony/website-skeleton '.$name); print $git_clone; $git_chmod = shell_exec('sudo chmod 775 '.MODULES_PATH.'/'.$name.' -R'); @@ -114,17 +117,17 @@ class Module print $git_chown; $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module_symfony.php '.CONTROLLERS_PATH.'/'.$name.'.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/'.$name.'.php'); - $controlleur = preg_replace('%MODULE%',$name,$controlleur); + $controlleur = preg_replace('%MODULE%', $name, $controlleur); file_put_contents(CONTROLLERS_PATH.'/'.$name.'.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/'.$name.'.model'); $modele = file_get_contents(MODELS_PATH.'/'.$name.'.model'); - $modele = preg_replace('%MODULE%',$name,$modele); + $modele = preg_replace('%MODULE%', $name, $modele); file_put_contents(MODELS_PATH.'/'.$name.'.model', $modele); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/'.$name.'.blade.php'); $vue = file_get_contents(VIEW_PATH.'/view/'.$name.'.blade.php'); - $vue = preg_replace('%MODULE%','symfony',$vue); + $vue = preg_replace('%MODULE%', 'symfony', $vue); file_put_contents(VIEW_PATH.'/view/'.$name.'.blade.php', $vue); print $git_view; @@ -141,10 +144,9 @@ class Module ."\n'.$name.' : Application permettant d'intégrer un module avec symfony" ."\n " ."\n et de créer la base de données!\n"; - } - static public function removeSymfony($name = 'symfony'){ - + public static function removeSymfony($name = 'symfony') + { $git_clone = system('rm -Rf '.MODULES_PATH.'/'.$name, $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/'.$name, $git_ln_1_retval); @@ -157,8 +159,8 @@ class Module print $git_view_retval; } - static public function addWordpress($version = '5.4'){ - + public static function addWordpress($version = '5.4') + { $git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/WordPress/WordPress.git wordpress'); print $git_clone; $git_fetch = shell_exec('cd '.MODULES_PATH.'/wordpress && git fetch --all --tags'); @@ -172,21 +174,21 @@ class Module $git_ln_1 = shell_exec('cd '.PUBLIC_PATH.' && ln -s ../application/modules/wordpress/ wordpress'); print $git_ln_1; - $languages = shell_exec('cp '.CONSOLE_PATH.'/skel/wordpress '.MODULES_PATH ); + $languages = shell_exec('cp '.CONSOLE_PATH.'/skel/wordpress '.MODULES_PATH); $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/wordpress.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/wordpress.php'); - $controlleur = preg_replace('%MODULE%','wordpress',$controlleur); + $controlleur = preg_replace('%MODULE%', 'wordpress', $controlleur); file_put_contents(CONTROLLERS_PATH.'/wordpress.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/wordpress.model'); $modele = file_get_contents(MODELS_PATH.'/wordpress.model'); - $modele = preg_replace('%MODULE%','wordpress',$modele); + $modele = preg_replace('%MODULE%', 'wordpress', $modele); file_put_contents(MODELS_PATH.'/wordpress.model', $modele); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/wordpress.blade.php'); $vue = file_get_contents(VIEW_PATH.'/view/wordpress.blade.php'); - $vue = preg_replace('%MODULE%','wordpress',$vue); + $vue = preg_replace('%MODULE%', 'wordpress', $vue); file_put_contents(VIEW_PATH.'/view/wordpress.blade.php', $vue); print $git_view; @@ -194,10 +196,9 @@ class Module ."\nwordpress : Application permettant de générer un blog wordpress" ."\n " ."\n et de créer la base de données!\n"; - } - static public function removeWordpress(){ - + public static function removeWordpress() + { $git_clone = system('sudo rm -Rf '.MODULES_PATH.'/wordpress', $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/wordpress', $git_ln_1_retval); @@ -210,8 +211,8 @@ class Module print $git_view_retval; } - static public function addPrestashop($version = '1.7.5.0'){ - + public static function addPrestashop($version = '1.7.5.0') + { $git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/PrestaShop/PrestaShop.git prestashop'); print $git_clone; $git_fetch = shell_exec('cd '.MODULES_PATH.'/prestashop && git fetch --all --tags'); @@ -230,17 +231,17 @@ class Module print $git_ln_2; $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/prestashop.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/prestashop.php'); - $controlleur = preg_replace('%MODULE%','prestashop',$controlleur); + $controlleur = preg_replace('%MODULE%', 'prestashop', $controlleur); file_put_contents(CONTROLLERS_PATH.'/prestashop.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/prestashop.model'); $controlleur = file_get_contents(MODELS_PATH.'/prestashop.model'); - $controlleur = preg_replace('%MODULE%','prestashop',$controlleur); + $controlleur = preg_replace('%MODULE%', 'prestashop', $controlleur); file_put_contents(MODELS_PATH.'/prestashop.model', $controlleur); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/prestashop.blade.php'); $controlleur = file_get_contents(VIEW_PATH.'/view/prestashop.blade.php'); - $controlleur = preg_replace('%MODULE%','prestashop',$controlleur); + $controlleur = preg_replace('%MODULE%', 'prestashop', $controlleur); file_put_contents(VIEW_PATH.'/view/prestashop.blade.php', $controlleur); print $git_view; @@ -249,8 +250,8 @@ class Module ."\n " ."\n et de créer la base de données!\n"; } - static public function removePrestashop(){ - + public static function removePrestashop() + { $git_clone = system('rm -Rf '.MODULES_PATH.'/prestashop', $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/prestashop', $git_ln_1_retval); @@ -263,7 +264,8 @@ class Module print $git_view_retval; } - static public function addPhplist($version = '3.5.2'){ + public static function addPhplist($version = '3.5.2') + { /*$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/phpList/phplist3.git phplist'); print $git_clone; @@ -290,65 +292,65 @@ class Module print $git_chown; $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/phplist.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/phplist.php'); - $controlleur = preg_replace('%MODULE%','phplist',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phplist', $controlleur); file_put_contents(CONTROLLERS_PATH.'/phplist.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/phplist.model'); $controlleur = file_get_contents(MODELS_PATH.'/phplist.model'); - $controlleur = preg_replace('%MODULE%','phplist',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phplist', $controlleur); file_put_contents(MODELS_PATH.'/phplist.model', $controlleur); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/phplist.blade.php'); $controlleur = file_get_contents(VIEW_PATH.'/view/phplist.blade.php'); - $controlleur = preg_replace('%MODULE%','phplist',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phplist', $controlleur); file_put_contents(VIEW_PATH.'/view/phplist.blade.php', $controlleur); print $git_view; print "Quel est le host de la base de donnees (default:192.168.1.70) ? "; $host = trim(fgets(STDIN)); - if($host !== '' && preg_match('#(.)+#',$host)){ + if ($host !== '' && preg_match('#(.)+#', $host)) { $host = $host; - }else{ + } else { $host = '192.168.1.70'; } print "Quel est le nom de la base de donnees (default:SAND_phplist) ? "; $host_name = trim(fgets(STDIN)); - if($host_name !== '' && preg_match('#(.)+#',$host_name)){ + if ($host_name !== '' && preg_match('#(.)+#', $host_name)) { $host_name = $host_name; - }else{ + } else { $host_name = 'SAND_phplist'; } print "Quel est le user de la base de donnees (default:sand) ? "; $user = trim(fgets(STDIN)); - if($user !== '' && preg_match('#(.)+#',$user)){ + if ($user !== '' && preg_match('#(.)+#', $user)) { $user = $user; - }else{ + } else { $user = 'sand'; } print "Quel est le pass de la base de donnees (default:sand) ? "; $pass = trim(fgets(STDIN)); - if($pass !== '' && preg_match('#(.)+#',$pass)){ + if ($pass !== '' && preg_match('#(.)+#', $pass)) { $pass = $pass; - }else{ + } else { $pass = 'sand'; } $config_skel = shell_exec('cp '.CONSOLE_PATH.'/skel/phplist/config.skel.php '.MODULES_PATH.'/phplist/public_html/lists/config/config.php'); $config = file_get_contents(MODULES_PATH.'/phplist/public_html/lists/config/config.php'); - $config = preg_replace('%HOST_HOSTNAME%',$host,$config); - $config = preg_replace('%HOST_USERNAME%',$user,$config); - $config = preg_replace('%HOST_NAME%',$host_name,$config); - $config = preg_replace('%HOST_PASSWORD%',$pass,$config); - $config = preg_replace('%HOST_PAGEROOT%','/phplist',$config); - file_put_contents(MODULES_PATH.'/phplist/public_html/lists/config/config.php',$config); + $config = preg_replace('%HOST_HOSTNAME%', $host, $config); + $config = preg_replace('%HOST_USERNAME%', $user, $config); + $config = preg_replace('%HOST_NAME%', $host_name, $config); + $config = preg_replace('%HOST_PASSWORD%', $pass, $config); + $config = preg_replace('%HOST_PAGEROOT%', '/phplist', $config); + file_put_contents(MODULES_PATH.'/phplist/public_html/lists/config/config.php', $config); print "\n\nN'oubliez pas d'ajouter au fichier '/application/modules/setup/registre.model' :" ."\nphplist : Application permettant de générer une newsletter phplist" ."\n " ."\n et de créer la base de données!\n"; } - static public function removePhplist(){ - + public static function removePhplist() + { $git_clone = system('rm -Rf '.MODULES_PATH.'/phplist', $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/phplist', $git_ln_1_retval); @@ -362,8 +364,8 @@ class Module $git_view = system('rm -f '.VIEW_PATH.'/view/phplist.blade.php', $git_view_retval); print $git_view_retval; } - static public function addWanewsletter($version = 'release-3.0.1'){ - + public static function addWanewsletter($version = 'release-3.0.1') + { $git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/wascripts/wanewsletter.git wanewsletter'); print $git_clone; $git_fetch = shell_exec('cd '.MODULES_PATH.'/wanewsletter && git fetch --all --tags'); @@ -380,17 +382,17 @@ class Module print $git_chown; $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/wanewsletter.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/wanewsletter.php'); - $controlleur = preg_replace('%MODULE%','wanewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'wanewsletter', $controlleur); file_put_contents(CONTROLLERS_PATH.'/wanewsletter.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/wanewsletter.model'); $controlleur = file_get_contents(MODELS_PATH.'/wanewsletter.model'); - $controlleur = preg_replace('%MODULE%','wanewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'wanewsletter', $controlleur); file_put_contents(MODELS_PATH.'/wanewsletter.model', $controlleur); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/wanewsletter.blade.php'); $controlleur = file_get_contents(VIEW_PATH.'/view/wanewsletter.blade.php'); - $controlleur = preg_replace('%MODULE%','wanewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'wanewsletter', $controlleur); file_put_contents(VIEW_PATH.'/view/wanewsletter.blade.php', $controlleur); print $git_view; @@ -437,8 +439,8 @@ class Module ."\n " ."\n et de créer la base de données!\n"; } - static public function removeWanewsletter(){ - + public static function removeWanewsletter() + { $git_clone = system('rm -Rf '.MODULES_PATH.'/wanewsletter', $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/wanewsletter', $git_ln_1_retval); @@ -450,8 +452,8 @@ class Module $git_view = system('rm -f '.VIEW_PATH.'/view/wanewsletter.blade.php', $git_view_retval); print $git_view_retval; } - static public function addPHPMyNewsletter($version = 'v2.0.5'){ - + public static function addPHPMyNewsletter($version = 'v2.0.5') + { $git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/Arnaud69/phpmynewsletter-2.0.git phpmynewsletter'); print $git_clone; $git_fetch = shell_exec('cd '.MODULES_PATH.'/phpmynewsletter && git fetch --all --tags'); @@ -468,17 +470,17 @@ class Module print $git_chown; $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/module.php '.CONTROLLERS_PATH.'/phpmynewsletter.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/phpmynewsletter.php'); - $controlleur = preg_replace('%MODULE%','phpmynewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phpmynewsletter', $controlleur); file_put_contents(CONTROLLERS_PATH.'/phpmynewsletter.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/module.model '.MODELS_PATH.'/phpmynewsletter.model'); $controlleur = file_get_contents(MODELS_PATH.'/phpmynewsletter.model'); - $controlleur = preg_replace('%MODULE%','phpmynewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phpmynewsletter', $controlleur); file_put_contents(MODELS_PATH.'/phpmynewsletter.model', $controlleur); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/module.blade.php '.VIEW_PATH.'/view/phpmynewsletter.blade.php'); $controlleur = file_get_contents(VIEW_PATH.'/view/phpmynewsletter.blade.php'); - $controlleur = preg_replace('%MODULE%','phpmynewsletter',$controlleur); + $controlleur = preg_replace('%MODULE%', 'phpmynewsletter', $controlleur); file_put_contents(VIEW_PATH.'/view/phpmynewsletter.blade.php', $controlleur); print $git_view; @@ -525,8 +527,8 @@ class Module ."\n " ."\n et de créer la base de données!\n"; } - static public function removePHPMyNewsletter(){ - + public static function removePHPMyNewsletter() + { $git_clone = system('rm -Rf '.MODULES_PATH.'/phpmynewsletter', $git_clone_retval); print $git_clone_retval; $git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/phpmynewsletter', $git_ln_1_retval); @@ -538,4 +540,4 @@ class Module $git_view = system('rm -f '.VIEW_PATH.'/view/phpmynewsletter.blade.php', $git_view_retval); print $git_view_retval; } -} \ No newline at end of file +} diff --git a/console/command/Page.php b/console/command/Page.php index faa362b..a139543 100644 --- a/console/command/Page.php +++ b/console/command/Page.php @@ -4,37 +4,39 @@ namespace MVC\Command; class Page { - - static public function help(){ + public static function help() + { print "explaination of the command\n\n"; } - static public function add(){ + public static function add() + { print "adding page...\n\n"; print "Quel est le nom de la page a ajouter? "; $page = trim(fgets(STDIN)); $git_controlleur = shell_exec('cp '.CONSOLE_PATH.'/skel/page.php '.CONTROLLERS_PATH.'/'.$page.'.php'); $controlleur = file_get_contents(CONTROLLERS_PATH.'/'.$page.'.php'); - $controlleur = preg_replace('%PAGE%',$page,$controlleur); + $controlleur = preg_replace('%PAGE%', $page, $controlleur); file_put_contents(CONTROLLERS_PATH.'/'.$page.'.php', $controlleur); print $git_controlleur; $git_modele = shell_exec('cp '.CONSOLE_PATH.'/skel/page.model '.MODELS_PATH.'/'.$page.'.model'); $controlleur = file_get_contents(MODELS_PATH.'/'.$page.'.model'); - $controlleur = preg_replace('%PAGE%',$page,$controlleur); + $controlleur = preg_replace('%PAGE%', $page, $controlleur); file_put_contents(MODELS_PATH.'/'.$page.'.model', $controlleur); print $git_modele; $git_view = shell_exec('cp '.CONSOLE_PATH.'/skel/page.blade.php '.VIEW_PATH.'/view/'.$page.'.blade.php'); $controlleur = file_get_contents(VIEW_PATH.'/view/'.$page.'.blade.php'); - $controlleur = preg_replace('%PAGE%',$page,$controlleur); + $controlleur = preg_replace('%PAGE%', $page, $controlleur); file_put_contents(VIEW_PATH.'/view/'.$page.'.blade.php', $controlleur); print $git_view; } - static public function remove(){ + public static function remove() + { print "removing page...\n\n"; print "Quel est le nom de la page a supprimer? "; - $handle = fopen ("php://stdin","r"); + $handle = fopen("php://stdin", "r"); $page = fgets($handle); $git_controlleur = system('rm -f '.CONTROLLERS_PATH.'/'.$page.'.php', $git_controlleur_retval); print $git_controlleur_retval; @@ -43,5 +45,4 @@ class Page $git_view = system('rm -f '.VIEW_PATH.'/view/'.$page.'.blade.php', $git_view_retval); print $git_view_retval; } - -} \ No newline at end of file +} diff --git a/console/command/Symfony.php b/console/command/Symfony.php index d0e19ad..b24dbae 100644 --- a/console/command/Symfony.php +++ b/console/command/Symfony.php @@ -4,14 +4,14 @@ namespace MVC\Command; class Symfony { - - static public function help(){ + public static function help() + { print "explaination of the command\n\n"; } - static public function stabilize(){ + public static function stabilize() + { print "stabilize symfony module...\n\n"; $symfony_module = shell_exec('sudo cp '.CONSOLE_PATH.'/skel/symfony '.VENDOR_PATH.' -Rf'); } - -} \ No newline at end of file +} diff --git a/console/skel/module.php b/console/skel/module.php index 6254665..91900d9 100644 --- a/console/skel/module.php +++ b/console/skel/module.php @@ -1,3 +1,3 @@ $app); \ No newline at end of file +$app = new MVC\Classe\Modular($name, 'MODULE', $url_params); +$templateData = array('app' => $app); diff --git a/console/skel/module_symfony.php b/console/skel/module_symfony.php index 787d617..df1353d 100644 --- a/console/skel/module_symfony.php +++ b/console/skel/module_symfony.php @@ -3,5 +3,5 @@ use MVC\Classe\Session; Session::start(); -$app = new MVC\Classe\Modular($name,'MODULE',$url_params); -$templateData = array('app' => $app); \ No newline at end of file +$app = new MVC\Classe\Modular($name, 'MODULE', $url_params); +$templateData = array('app' => $app); diff --git a/console/skel/page.php b/console/skel/page.php index c01f667..9e45464 100644 --- a/console/skel/page.php +++ b/console/skel/page.php @@ -4,4 +4,4 @@ use MVC\Classe\Logger; $templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge'); -Logger::addLog('ok', 'Hello world'); \ No newline at end of file +Logger::addLog('ok', 'Hello world'); diff --git a/console/skel/phplist/config.skel.php b/console/skel/phplist/config.skel.php index 24a9a87..5ba04e9 100644 --- a/console/skel/phplist/config.skel.php +++ b/console/skel/phplist/config.skel.php @@ -663,7 +663,7 @@ define('UPLOADIMAGES_DIR', 'uploadimages'); // EMBEDEXTERNALIMAGES // this flag will fetch images in your content that are remotely hosted and put them // inside the message that is sent. -define('EMBEDEXTERNALIMAGES',false); +define('EMBEDEXTERNALIMAGES', false); // Manual text part, will give you an input box for the text version of the message diff --git a/console/skel/symfony-app/src/Controller/AdminController.php b/console/skel/symfony-app/src/Controller/AdminController.php index 5a7e101..e55c590 100644 --- a/console/skel/symfony-app/src/Controller/AdminController.php +++ b/console/skel/symfony-app/src/Controller/AdminController.php @@ -1,6 +1,7 @@ "); - //print_r($this->get('session')); + print_r("
");
+        //print_r($this->get('session'));
         print_r($_COOKIE);
         print_r($_SESSION);
         print_r("
"); diff --git a/console/skel/symfony-app/src/Controller/ErrorController.php b/console/skel/symfony-app/src/Controller/ErrorController.php index 65162e7..6fd3919 100644 --- a/console/skel/symfony-app/src/Controller/ErrorController.php +++ b/console/skel/symfony-app/src/Controller/ErrorController.php @@ -1,6 +1,7 @@ "); - //print_r($this->get('session')); + print_r("
");
+        //print_r($this->get('session'));
         print_r($_COOKIE);
         print_r($_SESSION);
         print_r("
"); diff --git a/console/skel/symfony-app/src/Events/OnAuthenticationFailureEvent.php b/console/skel/symfony-app/src/Events/OnAuthenticationFailureEvent.php index fafda8d..8e51630 100644 --- a/console/skel/symfony-app/src/Events/OnAuthenticationFailureEvent.php +++ b/console/skel/symfony-app/src/Events/OnAuthenticationFailureEvent.php @@ -7,32 +7,35 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; - -class OnAuthenticationFailureEvent extends Event { - +class OnAuthenticationFailureEvent extends Event +{ const NAME = "session_auth.event.on_authentication_failure"; - public function __construct(Request $request, AuthenticationException $exception) { + public function __construct(Request $request, AuthenticationException $exception) + { $this->request = $request; $this->exception = $exception; $this->response = new Response($exception->getMessage(), Response::HTTP_FORBIDDEN); } - public function getRequest() { + public function getRequest() + { return $this->request; } - public function getException() { + public function getException() + { return $this->exception; } - public function getResponse() { + public function getResponse() + { return $this->response; } - public function setResponse($response) { + public function setResponse($response) + { $this->response = $response; return $this; } - } diff --git a/console/skel/symfony-app/src/Events/OnAuthenticationSuccessEvent.php b/console/skel/symfony-app/src/Events/OnAuthenticationSuccessEvent.php index e83d65b..9f6fbe8 100644 --- a/console/skel/symfony-app/src/Events/OnAuthenticationSuccessEvent.php +++ b/console/skel/symfony-app/src/Events/OnAuthenticationSuccessEvent.php @@ -5,27 +5,29 @@ use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\HttpFoundation\Request; - -class OnAuthenticationSuccessEvent extends Event { - +class OnAuthenticationSuccessEvent extends Event +{ const NAME = "session_auth.event.on_authentication_success"; - public function __construct(Request $request, TokenInterface $token, $providerKey) { + public function __construct(Request $request, TokenInterface $token, $providerKey) + { $this->request = $request; $this->token = $token; $this->providerKey = $providerKey; } - public function getRequest() { + public function getRequest() + { return $this->request; } - public function getToken() { + public function getToken() + { return $this->exception; } - public function getProviderKey() { + public function getProviderKey() + { return $this->providerKey; } - } diff --git a/console/skel/symfony-app/src/Security/AccessDeniedHandler.php b/console/skel/symfony-app/src/Security/AccessDeniedHandler.php index 9ee021f..3fad54a 100644 --- a/console/skel/symfony-app/src/Security/AccessDeniedHandler.php +++ b/console/skel/symfony-app/src/Security/AccessDeniedHandler.php @@ -18,9 +18,10 @@ class AccessDeniedHandler implements AccessDeniedHandlerInterface public function handle(Request $request, AccessDeniedException $accessDeniedException) { $content = $this->twig->render( - 'default/unauthorized.html.twig', array() + 'default/unauthorized.html.twig', + array() ); $response = new Response($content, Response::HTTP_FORBIDDEN); return $response; } -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Security/AuthUser.php b/console/skel/symfony-app/src/Security/AuthUser.php index 38bfa47..6bf69bd 100644 --- a/console/skel/symfony-app/src/Security/AuthUser.php +++ b/console/skel/symfony-app/src/Security/AuthUser.php @@ -4,8 +4,8 @@ namespace App\Security; use Symfony\Component\Security\Core\User\UserInterface; -class AuthUser implements UserInterface{ - +class AuthUser implements UserInterface +{ private $id; private $username; private $status; @@ -14,7 +14,7 @@ class AuthUser implements UserInterface{ private $credentials; private $roles = []; - public function __construct($id, $username,$credentials, array $roles = []) + public function __construct($id, $username, $credentials, array $roles = []) { $this->username = $username; $this->id = $id; @@ -27,7 +27,7 @@ class AuthUser implements UserInterface{ { $roles = $this->roles; // guarantee every user at least has ROLE_USER - if($this->getId() == 1587184) { + if ($this->getId() == 1587184) { $roles[] = 'ROLE_ADMIN'; } return array_unique($roles); @@ -43,7 +43,8 @@ class AuthUser implements UserInterface{ return $this->username; } - public function getUser(){ + public function getUser() + { return $this; } @@ -93,5 +94,4 @@ class AuthUser implements UserInterface{ return true; } - -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Security/AuthUserProvider.php b/console/skel/symfony-app/src/Security/AuthUserProvider.php index 5e8c42a..24b4dcf 100644 --- a/console/skel/symfony-app/src/Security/AuthUserProvider.php +++ b/console/skel/symfony-app/src/Security/AuthUserProvider.php @@ -9,7 +9,6 @@ use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; - class AuthUserProvider implements UserProviderInterface { @@ -24,16 +23,17 @@ class AuthUserProvider implements UserProviderInterface * * @throws UsernameNotFoundException if the user is not found */ - public function loadUserByUsername($username) { + public function loadUserByUsername($username) + { $entity_user = $this->entity_user; return $this->authService->getUser($username); - // Load a User object from your data source or throw UsernameNotFoundException. + // Load a User object from your data source or throw UsernameNotFoundException. // The $username argument may not actually be a username: // it is whatever value is being returned by the getUsername() // method in your User class. // throw new \Exception('TODO: fill in loadUserByUsername() inside '.__FILE__); - } + } /** * Refreshes the user after being reloaded from the session. @@ -49,13 +49,15 @@ class AuthUserProvider implements UserProviderInterface * @return UserInterface */ - public function refreshUser(UserInterface $user) { + public function refreshUser(UserInterface $user) + { $user = $this->_ctrlInstanceUser($user); return $this->loadUserByUsername($user->getUsername()); } - private function _ctrlInstanceUser(UserInterface $user) { + private function _ctrlInstanceUser(UserInterface $user) + { $entity_user = $this->entity_user; if (!$user instanceof $entity_user) { @@ -74,4 +76,4 @@ class AuthUserProvider implements UserProviderInterface { return AuthUser::class === $class; } -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Security/SessionAuthenticator.php b/console/skel/symfony-app/src/Security/SessionAuthenticator.php index 7d149c8..c4e4795 100644 --- a/console/skel/symfony-app/src/Security/SessionAuthenticator.php +++ b/console/skel/symfony-app/src/Security/SessionAuthenticator.php @@ -17,13 +17,12 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; use Twig\Environment; - class SessionAuthenticator extends AbstractGuardAuthenticator { public $router; public $twig; - public function __construct(UrlGeneratorInterface $router,Environment $twig) + public function __construct(UrlGeneratorInterface $router, Environment $twig) { $this->router = $router; $this->twig = $twig; @@ -40,7 +39,7 @@ class SessionAuthenticator extends AbstractGuardAuthenticator Dumper::dump($_SESSION); if (isset($_SESSION['id_utilisateur'])) { return true; - }else{ + } else { return true; } } @@ -59,8 +58,8 @@ class SessionAuthenticator extends AbstractGuardAuthenticator { Dumper::dump("getUser"); if (!isset($_SESSION['id'])) { - $user = new \App\Security\AuthUser('0','not-connected',$credentials,['ROLE_USER']); - }else { + $user = new \App\Security\AuthUser('0', 'not-connected', $credentials, ['ROLE_USER']); + } else { $user = new \App\Security\AuthUser($_SESSION['id'], $_SESSION['username'], $credentials, ['ROLE_USER', 'ROLE_USER_CONNECTED']); } @@ -77,9 +76,9 @@ class SessionAuthenticator extends AbstractGuardAuthenticator // Return `true` to cause authentication success Dumper::dump("checkCredentials"); - if($user->getCredentials() === $credentials) { + if ($user->getCredentials() === $credentials) { return true; - }else{ + } else { return false; } } @@ -104,12 +103,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator // $url = $this->router->generate('unauthorized'); // return new RedirectResponse($url); $content = $this->twig->render( - 'default/unauthorized.html.twig', array() + 'default/unauthorized.html.twig', + array() ); $response = new Response($content, Response::HTTP_FORBIDDEN); return $response; - - } /** @@ -128,13 +126,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator // return new RedirectResponse($url); $content = $this->twig->render( - 'default/unauthorized.html.twig', array() + 'default/unauthorized.html.twig', + array() ); $response = new Response($content, Response::HTTP_FORBIDDEN); return $response; - - - } public function supportsRememberMe() @@ -142,11 +138,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator return false; } - public function onLogoutSuccess(Request $request) { + public function onLogoutSuccess(Request $request) + { //$homepage = $this->config["homepage"]; //return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL)); header('Location: /index.php'); return ; } - -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/Configuration.php b/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/Configuration.php index 0b9119a..cc8ba86 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/Configuration.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/Configuration.php @@ -11,12 +11,14 @@ use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html} */ -class Configuration implements ConfigurationInterface { +class Configuration implements ConfigurationInterface +{ /** * {@inheritdoc} */ - public function getConfigTreeBuilder() { + public function getConfigTreeBuilder() + { $treeBuilder = new TreeBuilder('session_auth'); $rootNode = $treeBuilder->getRootNode(); $rootNode @@ -36,15 +38,15 @@ class Configuration implements ConfigurationInterface { ->end() ; - $rootNode - ->validate() + $rootNode + ->validate() ->ifTrue(function ($v) { - if(!is_null($v['user_entity'])){ + if (!is_null($v['user_entity'])) { $class = $v['user_entity']; - if(!class_exists($class)){ + if (!class_exists($class)) { return true; } - return !array_key_exists("Symfony\Component\Security\Core\User\UserInterface", class_implements($class)); + return !array_key_exists("Symfony\Component\Security\Core\User\UserInterface", class_implements($class)); } return false; }) @@ -57,8 +59,8 @@ class Configuration implements ConfigurationInterface { return $treeBuilder; } - private function _addCasConfig(ArrayNodeDefinition $node) { - + private function _addCasConfig(ArrayNodeDefinition $node) + { $node ->children() ->arrayNode('cas')->info('A déclarer si authentification pas CAS.') @@ -75,17 +77,18 @@ class Configuration implements ConfigurationInterface { ->end() ; - $node - ->validate() + $node + ->validate() ->ifTrue(function ($v) { $cas_config = $v['cas']; - return ($v['type_auth']=="Cas" && (is_null($cas_config['hostname']) || is_null($cas_config['port']) || is_null($cas_config['uri'])) ); + return ($v['type_auth']=="Cas" && (is_null($cas_config['hostname']) || is_null($cas_config['port']) || is_null($cas_config['uri']))); }) ->thenInvalid("En utilisant le type d'authentification Cas vous devez renseigner la section 'cas' et ses clés 'hostname', 'port', 'uri'") ->end(); - } + } - private function _addRsaConfig(ArrayNodeDefinition $node) { + private function _addRsaConfig(ArrayNodeDefinition $node) + { $node ->children() ->arrayNode('rsa')->addDefaultsIfNotSet()->info('A déclarer si authentification pas RSA.') @@ -98,13 +101,13 @@ class Configuration implements ConfigurationInterface { ->end() ; - $node - ->validate() + $node + ->validate() ->ifTrue(function ($v) { $rsa_config = $v['rsa']; return ($v['type_auth']==="Rsa" && is_null($rsa_config['logout_url'])); }) ->thenInvalid("En utilisant le type d'authentification Rsa vous devez renseigner la section 'rsa' et sa clé 'logout_url'") ->end(); - } + } } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/SessionAuthExtension.php b/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/SessionAuthExtension.php index c6c4d72..b3d257c 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/SessionAuthExtension.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/DependencyInjection/SessionAuthExtension.php @@ -14,13 +14,14 @@ use Symfony\Component\DependencyInjection\ChildDefinition; * * @link http://symfony.com/doc/current/cookbook/bundles/extension.html */ -class SessionAuthExtension extends Extension { +class SessionAuthExtension extends Extension +{ /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) { - + public function load(array $configs, ContainerBuilder $container) + { $configs[0]['environment'] = $container->getParameter("kernel.environment"); $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); @@ -33,9 +34,9 @@ class SessionAuthExtension extends Extension { //definition du service d'authentification par défaut dans le cas où ce ne serait pas un service // fraichement créé par l'utilisateur dans le fichiers services.yaml - if(is_null($config["authentication_service"])){ + if (is_null($config["authentication_service"])) { $authentication_service = "session_auth.authentification"; - }else{ + } else { $authentication_service = $config["authentication_service"]; } @@ -62,21 +63,21 @@ class SessionAuthExtension extends Extension { ->addArgument(new Reference($authentication_service)) ->addArgument($config) ->setPublic(false); - }else{ + } else { $container->register('session_auth.user_provider', $config["provider"]) ->addArgument(new Reference($authentication_service)) ->addArgument($config) ->setPublic(false); } - $container->setDefinition('session_auth.configuration', new \Symfony\Component\DependencyInjection\Definition( \App\Besancon\AuthBundle\DependencyInjection\Configuration::class) ) + $container->setDefinition('session_auth.configuration', new \Symfony\Component\DependencyInjection\Definition(\App\Besancon\AuthBundle\DependencyInjection\Configuration::class)) ->setArguments([ $config, ]); } - public function getNamespace() { + public function getNamespace() + { return 'http://ac-besancon.fr/schema/dic/' . $this->getAlias(); } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Events/CheckCredentialsEvent.php b/console/skel/symfony-app/src/Session/AuthBundle/Events/CheckCredentialsEvent.php index 5e753bb..baf6689 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Events/CheckCredentialsEvent.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Events/CheckCredentialsEvent.php @@ -5,30 +5,34 @@ namespace App\Session\AuthBundle\Events; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\User\UserInterface; -class CheckCredentialsEvent extends Event { - +class CheckCredentialsEvent extends Event +{ const NAME = "besancon_auth.event.check_credentials"; private $access = true; - public function __construct($credentials, UserInterface $user_interface) { + public function __construct($credentials, UserInterface $user_interface) + { $this->credentials = $credentials; $this->user_interface = $user_interface; } - public function getCredentials() { + public function getCredentials() + { return $this->credentials; } - public function getUserInterface() { + public function getUserInterface() + { return $this->user_interface; } - public function getAccess() { + public function getAccess() + { return $this->access; } - public function setAccess($access) { + public function setAccess($access) + { $this->access = $access; return $this; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationFailureEvent.php b/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationFailureEvent.php index a3c1d75..04b0ff8 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationFailureEvent.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationFailureEvent.php @@ -7,32 +7,35 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; - -class OnAuthenticationFailureEvent extends Event { - +class OnAuthenticationFailureEvent extends Event +{ const NAME = "session_auth.event.on_authentication_failure"; - public function __construct(Request $request, AuthenticationException $exception) { + public function __construct(Request $request, AuthenticationException $exception) + { $this->request = $request; $this->exception = $exception; $this->response = new Response($exception->getMessage(), Response::HTTP_FORBIDDEN); } - public function getRequest() { + public function getRequest() + { return $this->request; } - public function getException() { + public function getException() + { return $this->exception; } - public function getResponse() { + public function getResponse() + { return $this->response; } - public function setResponse($response) { + public function setResponse($response) + { $this->response = $response; return $this; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationSuccessEvent.php b/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationSuccessEvent.php index ea3c4a8..2e64415 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationSuccessEvent.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Events/OnAuthenticationSuccessEvent.php @@ -5,27 +5,29 @@ use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\HttpFoundation\Request; - -class OnAuthenticationSuccessEvent extends Event { - +class OnAuthenticationSuccessEvent extends Event +{ const NAME = "session_auth.event.on_authentication_success"; - public function __construct(Request $request, TokenInterface $token, $providerKey) { + public function __construct(Request $request, TokenInterface $token, $providerKey) + { $this->request = $request; $this->token = $token; $this->providerKey = $providerKey; } - public function getRequest() { + public function getRequest() + { return $this->request; } - public function getToken() { + public function getToken() + { return $this->exception; } - public function getProviderKey() { + public function getProviderKey() + { return $this->providerKey; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthAbstract.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthAbstract.php index 1516673..67a1fb4 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthAbstract.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthAbstract.php @@ -15,7 +15,8 @@ namespace App\Session\AuthBundle\Security\Abstracts; use App\Session\AuthBundle\Utils\Config; use Symfony\Component\HttpFoundation\Response; -abstract class AuthAbstract { +abstract class AuthAbstract +{ /** * @var App\Besancon\AuthBundle\Security\Interfaces\AttributesInterface $ai Instance de CasAttributes ou RsaAttributes @@ -73,6 +74,4 @@ abstract class AuthAbstract { * */ abstract public function getUser($username); - - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthFinal.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthFinal.php index cd9e4e8..0f8c3ef 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthFinal.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/AuthFinal.php @@ -15,7 +15,8 @@ namespace App\Session\AuthBundle\Security\Abstracts; use App\Session\AuthBundle\Utils\Config; use Symfony\Component\HttpFoundation\Response; -class AuthFinal extends AuthAbstract { +class AuthFinal extends AuthAbstract +{ /** * Intancie le getters en fonction de la configuration @@ -33,7 +34,8 @@ class AuthFinal extends AuthAbstract { * @return void * * */ - public function setGetterAttributes($config) { + public function setGetterAttributes($config) + { $type_auth = Config::getDeclaredType($config); //dump('calls'); $getters = "\App\Session\AuthBundle\Security\Getters\\" . $type_auth . "Attributes"; @@ -55,7 +57,8 @@ class AuthFinal extends AuthAbstract { * @return Symfony\Component\HttpFoundation\Response * * */ - public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception) { + public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception) + { return new Response($exception->getMessage(), Response::HTTP_FORBIDDEN); } @@ -76,12 +79,12 @@ class AuthFinal extends AuthAbstract { * @return \Symfony\Component\Security\Core\User\UserInterface * */ - public function getUser($username) { + public function getUser($username) + { $roles_service = $this->getRoles(); $roles = (!is_null($roles_service) && is_array($roles_service)) ? $roles_service : array(); $user = new \App\Besancon\AuthBundle\Security\User\AuthUser($username, md5("8sQaz87dPPsdanYakq86f" . $username), $roles); return $user; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/GetterAbstract.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/GetterAbstract.php index 4f69232..5ba4e03 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/GetterAbstract.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Abstracts/GetterAbstract.php @@ -2,7 +2,7 @@ /** * Abstract class GetterAbstract - * + * * @package Besancon\AuthBundle\Security\Abstracts * @author Amine BEL HADJ ALI */ @@ -14,29 +14,35 @@ namespace App\Session\AuthBundle\Security\Abstracts; * * @author belhadjali */ -abstract class GetterAbstract { - - public function isACP(){ +abstract class GetterAbstract +{ + public function isACP() + { return $this->getFrEduFonctAdm() == "ACP"; } - public function isDIR(){ + public function isDIR() + { return $this->getFrEduFonctAdm() == "DIR"; } - public function isDEC(){ + public function isDEC() + { return $this->getFrEduFonctAdm() == "DEC"; } - public function isDIR1D(){ + public function isDIR1D() + { return $this->isDEC(); } - public function isIEN1D (){ + public function isIEN1D() + { return $this->getFrEduFonctAdm() == "IEN1D"; } - public function isDIO(){ + public function isDIO() + { return $this->getFrEduFonctAdm() == "IEN1D"; } } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/AuthenticatorFactory.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/AuthenticatorFactory.php index 696dced..fb35d94 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/AuthenticatorFactory.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/AuthenticatorFactory.php @@ -13,9 +13,10 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use App\Session\AuthBundle\Utils\Config; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class AuthenticatorFactory { - - public static function getAuthenticator(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator,EventDispatcherInterface $dispatcher) { +class AuthenticatorFactory +{ + public static function getAuthenticator(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) + { $type_auth = Config::getDeclaredType($config); $authenticator_class = "App\Session\AuthBundle\Security\\" . $type_auth . "Authenticator"; @@ -23,5 +24,4 @@ class AuthenticatorFactory { return $authenticator; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/CasAuthenticator.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/CasAuthenticator.php index 6d7c99e..a3fe53c 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/CasAuthenticator.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/CasAuthenticator.php @@ -28,12 +28,13 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Guard\AuthenticatorInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface { - +class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface +{ private $authService; private $urlGenerator; - public function __construct(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) { + public function __construct(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) + { $this->urlGenerator = $urlGenerator; //Récupérer le service déaclaré authService $this->authService = $authService; @@ -51,31 +52,34 @@ class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS * Called on every request. Return whatever credentials you want, * or null to stop authentication. */ - public function getCredentials(Request $request) { + public function getCredentials(Request $request) + { return true; } - public function getUser($credentials, UserProviderInterface $userProvider) { + public function getUser($credentials, UserProviderInterface $userProvider) + { $username = \phpCAS::getUser(); $user = $userProvider->loadUserByUsername($username); return $user; } - public function checkCredentials($credentials, UserInterface $user) { + public function checkCredentials($credentials, UserInterface $user) + { return $this->authService->ctrlAccess($user); } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { - + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + { $event = new OnAuthenticationSuccessEvent($request, $token, $providerKey); $this->dispatcher->dispatch(OnAuthenticationSuccessEvent::NAME, $event); $this->authService->onSuccess($token); -// on success, let the request continue + // on success, let the request continue } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { $event = new OnAuthenticationFailureEvent($request, $exception); $this->dispatcher->dispatch(OnAuthenticationFailureEvent::NAME, $event); @@ -90,25 +94,28 @@ class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS // return new RedirectResponse($url); // } - public function supportsRememberMe() { + public function supportsRememberMe() + { return false; } -//implementation LogoutSuccessHandlerInterface - public function onLogoutSuccess(Request $request) { + //implementation LogoutSuccessHandlerInterface + public function onLogoutSuccess(Request $request) + { $homepage = $this->config["homepage"]; return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL)); } - protected function getLoginUrl() { + protected function getLoginUrl() + { return \phpCas::getServerLoginURL(); } - public function supports(Request $request) { + public function supports(Request $request) + { if (isset($this->config['environment']) && $this->config['environment'] == "test") { return false; } return true; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/DefaultAuthentication.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/DefaultAuthentication.php index 1b58b51..ca9302e 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/DefaultAuthentication.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/DefaultAuthentication.php @@ -30,7 +30,8 @@ use Symfony\Component\Security\Core\User\UserChecker; * * @author belhadjali */ -class DefaultAuthentication extends AuthFinal implements AuthInterface { +class DefaultAuthentication extends AuthFinal implements AuthInterface +{ /** * @var string Uniquely identifies the secured area @@ -48,9 +49,11 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface { 'secured_area' ); - $userProvider = new UserProvider( new Authentication(), + $userProvider = new UserProvider( + new Authentication(), array('user_entity' => 'App\Session\AuthBundle\Security\Auth\User', - 'type_auth' => 'Cas')); + 'type_auth' => 'Cas') + ); $userChecker = new UserChecker(); $defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000); @@ -65,7 +68,8 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface { $userProvider, $userChecker, 'secured_area', - $encoderFactory); + $encoderFactory + ); $authenticatedToken = $provider @@ -76,11 +80,13 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface { //$tokenStorage->setToken($authenticatedToken); } - public function getRoles() { + public function getRoles() + { return []; } - public function onSuccess($token) { + public function onSuccess($token) + { //dump($this->ai); //die('success'); @@ -95,12 +101,14 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface { return; } - public function ctrlAccess(\Symfony\Component\Security\Core\User\UserInterface $user) { + public function ctrlAccess(\Symfony\Component\Security\Core\User\UserInterface $user) + { //die('ctrlAccess'); return true; } - public function getUser($username) { + public function getUser($username) + { return parent::getUser($username); } } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/CasAttributes.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/CasAttributes.php index dd4e564..7560322 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/CasAttributes.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/CasAttributes.php @@ -1,5 +1,5 @@ */ @@ -15,62 +15,75 @@ use App\Session\AuthBundle\Security\Interfaces\AttributesInterface; * renvoyé par CAS à partir des méthodes d'accès définies dans l'interface AttributesInterface * */ -class CasAttributes implements AttributesInterface { - - public function getFirstName() { +class CasAttributes implements AttributesInterface +{ + public function getFirstName() + { return \phpCAS::getAttribute("prenom"); } - public function getCompletName() { + public function getCompletName() + { return \phpCAS::getAttribute("nomcomplet"); } - public function getName() { + public function getName() + { return \phpCAS::getAttribute("nom"); } - public function getDiscipline() { + public function getDiscipline() + { return \phpCAS::getAttribute("discipline"); } - public function getFonctM() { + public function getFonctM() + { return \phpCAS::getAttribute("fonctm"); } - public function getRne() { + public function getRne() + { return \phpCAS::getAttribute("rne"); } - public function getFreDuRne() { + public function getFreDuRne() + { return \phpCAS::getAttribute("FrEduRne"); } - public function getFreDuRneResp() { + public function getFreDuRneResp() + { return \phpCAS::getAttribute("FrEduRneResp"); } - public function getMail() { + public function getMail() + { return \phpCAS::getAttribute("mail"); } - public function getTitle() { + public function getTitle() + { return \phpCAS::getAttribute("title"); } - public function getUsername() { + public function getUsername() + { return \phpCAS::getUser(); } - public function getFrEduResDel(){ + public function getFrEduResDel() + { return \phpCAS::getAttribute("FrEduResDel"); } - public function getFrEduFonctAdm() { + public function getFrEduFonctAdm() + { return \phpCAS::getAttribute("FrEduFonctAdm"); } - public function getGrade() { + public function getGrade() + { return \phpCAS::getAttribute("grade"); } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/RsaAttributes.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/RsaAttributes.php index d00688a..7d703b0 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/RsaAttributes.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/RsaAttributes.php @@ -19,62 +19,75 @@ use App\Besancon\AuthBundle\Security\Interfaces\AttributesInterface; * renvoyé par RSA CT à partir des méthodes d'accès définies dans l'interface AttributesInterface * */ -class RsaAttributes implements AttributesInterface { - - public function getCompletName() { +class RsaAttributes implements AttributesInterface +{ + public function getCompletName() + { return (isset($_SERVER['HTTP_CN'])) ? $_SERVER['HTTP_CN'] : null; } - public function getDiscipline() { + public function getDiscipline() + { return (isset($_SERVER['HTTP_DISCIPLINE'])) ? $_SERVER['HTTP_DISCIPLINE'] : null; } - public function getFonctM() { + public function getFonctM() + { return (isset($_SERVER['HTTP_FONCTM'])) ? $_SERVER['HTTP_FONCTM'] : null; } - public function getRne() { + public function getRne() + { return (isset($_SERVER['HTTP_RNE'])) ? $_SERVER['HTTP_FREDURNE'] : null; } - public function getFreDuRne() { + public function getFreDuRne() + { return (isset($_SERVER['HTTP_FREDURNE'])) ? explode(',', $_SERVER['HTTP_FREDURNE']) : null; } - public function getFreDuRneResp() { + public function getFreDuRneResp() + { return (isset($_SERVER['HTTP_FREDURNERESP'])) ? explode(',', $_SERVER['HTTP_FREDURNERESP']) : null; } - public function getMail() { + public function getMail() + { return (isset($_SERVER['HTTP_CTEMAIL'])) ? $_SERVER['HTTP_CTEMAIL'] : null; } - public function getTitle() { + public function getTitle() + { return (isset($_SERVER['HTTP_TITLE'])) ? $_SERVER['HTTP_TITLE'] : null; } - public function getUsername() { + public function getUsername() + { return (isset($_SERVER['HTTP_CT_REMOTE_USER'])) ? $_SERVER['HTTP_CT_REMOTE_USER'] : null; } - public function getFrEduResDel() { + public function getFrEduResDel() + { return (isset($_SERVER['HTTP_FREDURESDEL'])) ? $_SERVER['HTTP_FREDURESDEL'] : null; } - public function getFrEduFonctAdm() { + public function getFrEduFonctAdm() + { return (isset($_SERVER['HTTP_FREDUFONCTADM'])) ? $_SERVER['HTTP_FREDUFONCTADM'] : null; } - public function getFirstName() { - return (isset($_SERVER['HTTP_CTFN'])) ? $_SERVER['HTTP_CTFN'] : null; + public function getFirstName() + { + return (isset($_SERVER['HTTP_CTFN'])) ? $_SERVER['HTTP_CTFN'] : null; } - public function getName() { - return (isset($_SERVER['HTTP_CTLN'])) ? $_SERVER['HTTP_CTLN'] : null; + public function getName() + { + return (isset($_SERVER['HTTP_CTLN'])) ? $_SERVER['HTTP_CTLN'] : null; } - public function getGrade() { + public function getGrade() + { return (isset($_SERVER['HTTP_GRADE'])) ? $_SERVER['HTTP_GRADE'] : null; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/SessionAttributes.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/SessionAttributes.php index 457c813..b19cd8e 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/SessionAttributes.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Getters/SessionAttributes.php @@ -15,62 +15,75 @@ use App\Session\AuthBundle\Security\Interfaces\AttributesInterface; * renvoyé par CAS à partir des méthodes d'accès définies dans l'interface AttributesInterface * */ -class SessionAttributes implements AttributesInterface { - - public function getFirstName() { +class SessionAttributes implements AttributesInterface +{ + public function getFirstName() + { return ; } - public function getCompletName() { + public function getCompletName() + { return ; } - public function getName() { + public function getName() + { return ; } - public function getDiscipline() { + public function getDiscipline() + { return ; } - public function getFonctM() { + public function getFonctM() + { return ; } - public function getRne() { + public function getRne() + { return ; } - public function getFreDuRne() { + public function getFreDuRne() + { return ; } - public function getFreDuRneResp() { + public function getFreDuRneResp() + { return ; } - public function getMail() { + public function getMail() + { return ; } - public function getTitle() { + public function getTitle() + { return ; } - public function getUsername() { + public function getUsername() + { return ; } - public function getFrEduResDel(){ + public function getFrEduResDel() + { return ; } - public function getFrEduFonctAdm() { + public function getFrEduFonctAdm() + { return ; } - public function getGrade() { + public function getGrade() + { return ; } - -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AttributesInterface.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AttributesInterface.php index 35367d0..a8cdf88 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AttributesInterface.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AttributesInterface.php @@ -15,201 +15,200 @@ namespace App\Session\AuthBundle\Security\Interfaces; */ interface AttributesInterface { + const NO_VALUE = "X"; - const NO_VALUE = "X"; - - const FREDURNE_OFFSET_RNE = 0; - const FREDURNE_OFFSET_SECTEUR = 2; - const FREDURNE_OFFSET_FONCTION_EXERCICE = 3; - const FREDURNE_OFFSET_FONCTION_RNEUAJ = 4; - const FREDURNE_OFFSET_1CODETNA = 5; // 1er chiffre code nature nomenclature - const FREDURNE_OFFSET_CODETTY = 6; // code type etablissement nomenclature - const FREDURNE_OFFSET_CODETNA = 7; // code nature etablissement nomenclature + const FREDURNE_OFFSET_RNE = 0; + const FREDURNE_OFFSET_SECTEUR = 2; + const FREDURNE_OFFSET_FONCTION_EXERCICE = 3; + const FREDURNE_OFFSET_FONCTION_RNEUAJ = 4; + const FREDURNE_OFFSET_1CODETNA = 5; // 1er chiffre code nature nomenclature + const FREDURNE_OFFSET_CODETTY = 6; // code type etablissement nomenclature + const FREDURNE_OFFSET_CODETNA = 7; // code nature etablissement nomenclature const FREDURNERESP_OFFSET_RNE = 0; - const FREDURNERESP_OFFSET_SECTEUR = 2; //PU ou PR + const FREDURNERESP_OFFSET_SECTEUR = 2; //PU ou PR const FREDURNERESP_OFFSET_AFFECTATION = 3; // A pour Affectation anticipé N pour affectation normale F pour affectation qui fini le 31/08 - const FREDURNERESP_OFFSET_1CODETNA = 4; // 1er chiffre code nature nomenclature - const FREDURNERESP_OFFSET_CODETTY = 5; // code type etablissement nomenclature - const FREDURNERESP_OFFSET_CODETNA = 6; // code nature nomenclature + const FREDURNERESP_OFFSET_1CODETNA = 4; // 1er chiffre code nature nomenclature + const FREDURNERESP_OFFSET_CODETTY = 5; // code type etablissement nomenclature + const FREDURNERESP_OFFSET_CODETNA = 6; // code nature nomenclature const TYPE_LYCEE_GENERAL = "LYC"; - const TYPE_LYCEE_PRO = "LP"; - const TYPE_COLLEGE = "CLG"; - const TYPE_SEGPA = "SES"; + const TYPE_LYCEE_PRO = "LP"; + const TYPE_COLLEGE = "CLG"; + const TYPE_SEGPA = "SES"; - const CODE_NATURE_RECTORAT = ["802"]; - const CODE_NATURE_DSDEN = ["806"]; - const CODE_NATURE_INSPECTION = ["809"]; - const CODE_NATURE_LYCEE_GENERAL_ET_TECHNO = ["300"]; - const CODE_NATURE_LYCEE_TECHNO = ["301"]; - const CODE_NATURE_LYCEE_GENERAL = ["302", "306"]; - const CODE_NATURE_LYCEE_AGRICOLE = ["307"]; - const CODE_NATURE_LYCEE_PRO = ["320"]; - const CODE_NATURE_COLLEGE = ["340"]; - const CODE_COLLEGE_NATURE_SPE = ["352"]; - const CODE_NATURE_SEGPA = ["390"]; + const CODE_NATURE_RECTORAT = ["802"]; + const CODE_NATURE_DSDEN = ["806"]; + const CODE_NATURE_INSPECTION = ["809"]; + const CODE_NATURE_LYCEE_GENERAL_ET_TECHNO = ["300"]; + const CODE_NATURE_LYCEE_TECHNO = ["301"]; + const CODE_NATURE_LYCEE_GENERAL = ["302", "306"]; + const CODE_NATURE_LYCEE_AGRICOLE = ["307"]; + const CODE_NATURE_LYCEE_PRO = ["320"]; + const CODE_NATURE_COLLEGE = ["340"]; + const CODE_COLLEGE_NATURE_SPE = ["352"]; + const CODE_NATURE_SEGPA = ["390"]; - const GRADES_IEN = ["1152", "1151"]; + const GRADES_IEN = ["1152", "1151"]; - const GRADES_RECTEUR = ["0201"]; - const GRADES_SG = ["0211", "0911", "0912"]; - const GRADES_ASG = ["0981"]; + const GRADES_RECTEUR = ["0201"]; + const GRADES_SG = ["0211", "0911", "0912"]; + const GRADES_ASG = ["0981"]; - const GRADES_DASEN = ["0921", "0922"]; - const GRADES_ADJOINT_DASEN = ["0971"]; + const GRADES_DASEN = ["0921", "0922"]; + const GRADES_ADJOINT_DASEN = ["0971"]; - const CODES_DISCIPLINE_ASH = ["N0006"]; - const CODES_DISCIPLINE_DIR = ["D0010"]; - const CODES_DISCIPLINE_ADJOINT_DIR = ["D0011"]; - /** - * Renvoie le prénom de l'agent - * - * Correspond au champ "givenName" du LDAP - * - * @return string|null - * prénom de l'agent - */ - public function getFirstName(); + const CODES_DISCIPLINE_ASH = ["N0006"]; + const CODES_DISCIPLINE_DIR = ["D0010"]; + const CODES_DISCIPLINE_ADJOINT_DIR = ["D0011"]; + /** + * Renvoie le prénom de l'agent + * + * Correspond au champ "givenName" du LDAP + * + * @return string|null + * prénom de l'agent + */ + public function getFirstName(); - /** - * Renvoie l'identifiant LDAP de l'agent - * - * Correspond au champ "uid" du LDAP - * - * @return string|null - * uid de l'agent - */ - public function getUsername(); + /** + * Renvoie l'identifiant LDAP de l'agent + * + * Correspond au champ "uid" du LDAP + * + * @return string|null + * uid de l'agent + */ + public function getUsername(); - /** - * Renvoie le nom de famille de l'agent - * - * Correspond au champ "sn" du LDAP - * - * @return string|null - * nom de l'agent - */ - public function getName(); + /** + * Renvoie le nom de famille de l'agent + * + * Correspond au champ "sn" du LDAP + * + * @return string|null + * nom de l'agent + */ + public function getName(); - /** - * Renvoie l'adresse mail de l'agent - * - * Correspond au champ "mail" du LDAP - * - * @return string|null - * adresse mail de l'agent - */ - public function getMail(); + /** + * Renvoie l'adresse mail de l'agent + * + * Correspond au champ "mail" du LDAP + * + * @return string|null + * adresse mail de l'agent + */ + public function getMail(); - /** - * Renvoie le nom complet de l'agent - * - * Correspond au champ "cn" du LDAP - * - * @return string|null - * nom complete de l'agent - */ - public function getCompletName(); + /** + * Renvoie le nom complet de l'agent + * + * Correspond au champ "cn" du LDAP + * + * @return string|null + * nom complete de l'agent + */ + public function getCompletName(); - /** - * Renvoie le title de l'agent - * - * Correspond au champ "title" du LDAP - * - * @return string|null - * title de l'agent - */ - public function getTitle(); + /** + * Renvoie le title de l'agent + * + * Correspond au champ "title" du LDAP + * + * @return string|null + * title de l'agent + */ + public function getTitle(); - /** - * Renvoie le code discipline de l'agent - * - * Correspond au champ "discipline" du LDAP - * - * @return string|null - * code discipline de l'agent - */ - public function getDiscipline(); + /** + * Renvoie le code discipline de l'agent + * + * Correspond au champ "discipline" du LDAP + * + * @return string|null + * code discipline de l'agent + */ + public function getDiscipline(); - /** - * Renvoie l'établissements d'affectation de l'agent - * - * Correspond au champ "rne" du LDAP - * - * @return string|null - * * établissement d'affectation de l'agent - */ - public function getRne(); + /** + * Renvoie l'établissements d'affectation de l'agent + * + * Correspond au champ "rne" du LDAP + * + * @return string|null + * * établissement d'affectation de l'agent + */ + public function getRne(); - /** - * Renvoie l'établissements d’exercice de l'agent - * - * Correspond au champ "FreDuRne" du LDAP - * - * @return array|null - * établissement(s) d'exercice de l'agent - */ - public function getFreDuRne(); + /** + * Renvoie l'établissements d’exercice de l'agent + * + * Correspond au champ "FreDuRne" du LDAP + * + * @return array|null + * établissement(s) d'exercice de l'agent + */ + public function getFreDuRne(); - /** - * Renvoie le(s) établissement(s) en responsabilité de l'agent - * - * Correspond au champ "FreDuRneResp" du LDAP - * - * @return array|null - * établissement(s) en responsabalité de l'agent - */ - public function getFreDuRneResp(); + /** + * Renvoie le(s) établissement(s) en responsabilité de l'agent + * + * Correspond au champ "FreDuRneResp" du LDAP + * + * @return array|null + * établissement(s) en responsabalité de l'agent + */ + public function getFreDuRneResp(); - /** - * Renvoie le(s) déléguation(s)/attribution(s) de l'agent ouvrant des droits d'accès - * à une ressource d'une application pour un ou des rne - * - * Correspond au champ "FreDuRneDel" du LDAP - * - * @return array|null - * déléguation(s)/attribution(s) de l'agent - */ - public function getFrEduResDel(); + /** + * Renvoie le(s) déléguation(s)/attribution(s) de l'agent ouvrant des droits d'accès + * à une ressource d'une application pour un ou des rne + * + * Correspond au champ "FreDuRneDel" du LDAP + * + * @return array|null + * déléguation(s)/attribution(s) de l'agent + */ + public function getFrEduResDel(); - /** - * Renvoie la fonction administrative de l'agent - * correspondant à un profil particulier - * - * Correspond au champ "FrEduFonctAdm" du LDAP - * - * @return string|null - * fonction administrative de l'agent - */ - public function getFrEduFonctAdm(); + /** + * Renvoie la fonction administrative de l'agent + * correspondant à un profil particulier + * + * Correspond au champ "FrEduFonctAdm" du LDAP + * + * @return string|null + * fonction administrative de l'agent + */ + public function getFrEduFonctAdm(); - /** - * Renvoie la fonction de l'agent - * Attention : initialisé à la création de la fiche avec la même valeur que l’attribut fonction. - * Puis, par l’application Annuaire, l’agent peut le modifier. - * - * Correspond au champ "fonctm" du LDAP - * - * @return string|null - * fonction de l'agent - */ - public function getFonctM(); + /** + * Renvoie la fonction de l'agent + * Attention : initialisé à la création de la fiche avec la même valeur que l’attribut fonction. + * Puis, par l’application Annuaire, l’agent peut le modifier. + * + * Correspond au champ "fonctm" du LDAP + * + * @return string|null + * fonction de l'agent + */ + public function getFonctM(); - /** - * Renvoie le grade de l'agent - * Alimenté à partir de la valeur agt.gradco - * Se référer à la base des nomenclatures dans la table N_GRADE pour voir - * les correspondances : http://infocentre.pleiade.education.fr/bcn/workspace/viewTable/n/N_GRADE - * - * Correspond au champ "grade" du LDAP - * - * @return string|null - * fonction de l'agent - */ - public function getGrade(); + /** + * Renvoie le grade de l'agent + * Alimenté à partir de la valeur agt.gradco + * Se référer à la base des nomenclatures dans la table N_GRADE pour voir + * les correspondances : http://infocentre.pleiade.education.fr/bcn/workspace/viewTable/n/N_GRADE + * + * Correspond au champ "grade" du LDAP + * + * @return string|null + * fonction de l'agent + */ + public function getGrade(); } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AuthInterface.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AuthInterface.php index 0df0e01..2f475fb 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AuthInterface.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/Interfaces/AuthInterface.php @@ -2,31 +2,31 @@ /** * Interface AuthInterface - * + * * Interface permettant de déclarer les méthodes incontournables pour l'authentification - * - * + * + * * @package Besancon\AuthBundle\Security\Interfaces * @author Amine BEL HADJ ALI - * + * */ namespace App\Session\AuthBundle\Security\Interfaces; - use Symfony\Component\Security\Core\User\UserInterface; -interface AuthInterface { +interface AuthInterface +{ /** * Contrôle de l'accès à partir des attributs CAS ou RSA - * + * * Vérifier les droits d'accès à l'application à partir des attributs récupérées des getters : * - CasAttributes - * - RsaAttributes - * + * - RsaAttributes + * * @param UserInterface $user * L'entité user récupéré par le provider - * + * * @return bool * - true si accès autorisé * - false si accès refusé @@ -35,52 +35,52 @@ interface AuthInterface { /** * Calcule et retoune le(s) rôle(s) à partir des attributs CAS ou RSA - * + * * Calculer le(s) rôle(s) à partir des attributs récupérées des getters : * - CasAttributes - * - RsaAttributes - * Doit retourner un tableau même vide - * + * - RsaAttributes + * Doit retourner un tableau même vide + * * @return array */ public function getRoles(); /** * Retourne un utilisateur pour la génération du token, si l'utilisateur n'existe pas en base de donnée - * - * ATTENTION : CETTE METHODE DOIT ÊTRE REDEFINIE SI UTILISATION D'UNE ENTITE UTILISTEUR + * + * ATTENTION : CETTE METHODE DOIT ÊTRE REDEFINIE SI UTILISATION D'UNE ENTITE UTILISTEUR * DIFFERENTE DE CELLE UTILISEE PAR DEFAUT - * + * * @param String $username * uid de l'utilisateur récupéré de Cas ou Rsa - * + * * @return UserInterface */ public function getUser($username); /** * Traitement personnalisé après récupération du token - * + * * Il est possible d'enrichir le token (attributs...) ou d'effectuer des contrôles supplémentaire - * - * @param $token + * + * @param $token * Token d'authification généré - * + * * @return null */ public function onSuccess($token); /** * Traitement personnalisé lorsque la connexion n'a pas abouti - * + * * Vérifié l'exception généré et adapter l'action (redirection, déconnexion...) - * - * Doit retourner un objet de type Response - * + * + * Doit retourner un objet de type Response + * * Exemple : - * - * ``` - * public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception) + * + * ``` + * public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception) * { * $content = $this->twig->render( * '@App/Test/forbiden.html.twig', array() @@ -90,9 +90,9 @@ interface AuthInterface { * } * ``` * - * @param AuthenticationException $exception + * @param AuthenticationException $exception * Exception générée par le provider - * + * * @return Symfony\Component\HttpFoundation\Response * */ diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/RsaAuthenticator.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/RsaAuthenticator.php index d2d9ed0..0ade6f8 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/RsaAuthenticator.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/RsaAuthenticator.php @@ -30,13 +30,14 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Security\Guard\AuthenticatorInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface { - +class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface +{ private $authService; private $urlGenerator; private $dispatcher; - public function __construct(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) { + public function __construct(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) + { $this->urlGenerator = $urlGenerator; //Récupérer le service déaclaré authService $this->authService = $authService; @@ -48,7 +49,8 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS * Called on every request. Return whatever credentials you want, * or null to stop authentication. */ - public function getCredentials(Request $request) { + public function getCredentials(Request $request) + { if (!isset($_SERVER['HTTP_CT_REMOTE_USER']) || empty($_SERVER['HTTP_CT_REMOTE_USER'])) { $this->returnRequest = $request->getUri(); throw new \LogicException("Impossible de continuer sous RSA : L'entête HTTP_CT_REMOTE_USER est vide ou manquante"); @@ -56,22 +58,24 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS return true; } - public function getUser($credentials, UserProviderInterface $userProvider) { + public function getUser($credentials, UserProviderInterface $userProvider) + { $username = $_SERVER['HTTP_CT_REMOTE_USER']; $user = $userProvider->loadUserByUsername($username); return $user; } - public function checkCredentials($credentials, UserInterface $user) { - $this->authService->ctrlAccess($user); + public function checkCredentials($credentials, UserInterface $user) + { + $this->authService->ctrlAccess($user); // check credentials - e.g. make sure the password is valid // no credential check is needed in this case // return true to cause authentication success return true; } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { - + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + { $event = new OnAuthenticationSuccessEvent($request, $token, $providerKey); $this->dispatcher->dispatch(OnAuthenticationSuccessEvent::NAME, $event); @@ -79,8 +83,8 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS // on success, let the request continue } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { $event = new OnAuthenticationFailureEvent($request, $exception); $this->dispatcher->dispatch(OnAuthenticationFailureEvent::NAME, $event); @@ -95,26 +99,30 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS // return new RedirectResponse($url); // } - public function supportsRememberMe() { + public function supportsRememberMe() + { return false; } //implementation LogoutSuccessHandlerInterface - public function onLogoutSuccess(Request $request) { + public function onLogoutSuccess(Request $request) + { $redirect = (isset($_SERVER['HTTP_FREDUURLRETOUR'])) ? $_SERVER['HTTP_FREDUURLRETOUR'] : $this->config['rsa']['logout_url']; return new RedirectResponse($redirect); } - protected function getLoginUrl() { + protected function getLoginUrl() + { $return_request = urlencode($this->returnRequest); $params = "?CT_ORIG_URL=" . $return_request; return $this->config['rsa']['login_url'] . $params; } - public function supports(Request $request) { + public function supports(Request $request) + { if (isset($this->config['environment']) && $this->config['environment'] == "test") { return false; } return true; } -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/SessionAuthenticator.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/SessionAuthenticator.php index a081536..1d1b13f 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/SessionAuthenticator.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/SessionAuthenticator.php @@ -33,7 +33,7 @@ class SessionAuthenticator extends AbstractGuardAuthenticator { if (isset($_SESSION['id_utilisateur'])) { return true; - }else{ + } else { return true; } } @@ -50,9 +50,9 @@ class SessionAuthenticator extends AbstractGuardAuthenticator public function getUser($credentials, UserProviderInterface $userProvider) { if (!isset($_SESSION['id_utilisateur'])) { - $user = new \App\Classes\AuthUser('','','','','',['ROLE_USER']); - }else { - $user = new \App\Classes\AuthUser($_SESSION['id_utilisateur'], $_SESSION['identifiant'], $_SESSION['status_compte'], $_SESSION['type_compte'],$credentials, ['ROLE_USER', 'ROLE_USER_CONNECTED']); + $user = new \App\Classes\AuthUser('', '', '', '', '', ['ROLE_USER']); + } else { + $user = new \App\Classes\AuthUser($_SESSION['id_utilisateur'], $_SESSION['identifiant'], $_SESSION['status_compte'], $_SESSION['type_compte'], $credentials, ['ROLE_USER', 'ROLE_USER_CONNECTED']); } // if a User is returned, checkCredentials() is called @@ -65,9 +65,9 @@ class SessionAuthenticator extends AbstractGuardAuthenticator // In case of an API token, no credential check is needed. // Return `true` to cause authentication success - if($user->getCredentials() === $credentials) { + if ($user->getCredentials() === $credentials) { return true; - }else{ + } else { return false; } } @@ -91,7 +91,6 @@ class SessionAuthenticator extends AbstractGuardAuthenticator // return new JsonResponse($data, Response::HTTP_UNAUTHORIZED); $url = $this->router->generate('unauthorized'); return new RedirectResponse($url); - } /** @@ -108,8 +107,6 @@ class SessionAuthenticator extends AbstractGuardAuthenticator $url = $this->router->generate('unauthorized'); return new RedirectResponse($url); - - } public function supportsRememberMe() @@ -117,11 +114,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator return false; } - public function onLogoutSuccess(Request $request) { + public function onLogoutSuccess(Request $request) + { //$homepage = $this->config["homepage"]; //return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL)); header('Location: /index.php'); return ; } - -} \ No newline at end of file +} diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUser.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUser.php index 0c6362b..2a5d25a 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUser.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUser.php @@ -17,47 +17,55 @@ namespace App\Session\AuthBundle\Security\User; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\EquatableInterface; -class AuthUser implements UserInterface, EquatableInterface { - +class AuthUser implements UserInterface, EquatableInterface +{ private $username; private $salt; private $roles = []; - public function __construct($username, $salt, array $roles = []) { + public function __construct($username, $salt, array $roles = []) + { $this->username = $username; $this->salt = $salt; $this->roles = $roles; } - public function getRoles() { + public function getRoles() + { return $this->roles; } - public function setRoles($roles) { + public function setRoles($roles) + { return $this->roles = $roles; } - public function addRole($role) { + public function addRole($role) + { return $this->roles[] = $role; } - public function getPassword() { + public function getPassword() + { return; } - public function getSalt() { + public function getSalt() + { return $this->salt; } - public function getUsername() { + public function getUsername() + { return $this->username; } - public function eraseCredentials() { - + public function eraseCredentials() + { } - public function isEqualTo(UserInterface $user) { + public function isEqualTo(UserInterface $user) + { if (!$user instanceof AuthUser) { return false; } @@ -72,5 +80,4 @@ class AuthUser implements UserInterface, EquatableInterface { return true; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUserProvider.php b/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUserProvider.php index 38fb807..00419d7 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUserProvider.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Security/User/AuthUserProvider.php @@ -13,9 +13,10 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; -class AuthUserProvider implements UserProviderInterface { - - public function __construct(AuthInterface $authService, Array $config) { +class AuthUserProvider implements UserProviderInterface +{ + public function __construct(AuthInterface $authService, array $config) + { $this->config = $config; if (!is_null($this->config['user_entity'])) { @@ -26,33 +27,36 @@ class AuthUserProvider implements UserProviderInterface { $this->authService = $authService; } - public function loadUserByUsername($username) { + public function loadUserByUsername($username) + { $entity_user = $this->entity_user; return $this->authService->getUser($username); } - private function _ctrlInstanceUser(UserInterface $user) { + private function _ctrlInstanceUser(UserInterface $user) + { $entity_user = $this->entity_user; if (!$user instanceof $entity_user) { throw new UnsupportedUserException( - sprintf('Instances of "%s" are not supported.', get_class($user)) + sprintf('Instances of "%s" are not supported.', get_class($user)) ); } return $user; } - public function refreshUser(UserInterface $user) { + public function refreshUser(UserInterface $user) + { $user = $this->_ctrlInstanceUser($user); return $this->loadUserByUsername($user->getUsername()); } - public function supportsClass($class) { + public function supportsClass($class) + { $entity_user = $this->entity_user; return $this->entity_class === $class; } - } diff --git a/console/skel/symfony-app/src/Session/AuthBundle/Utils/Config.php b/console/skel/symfony-app/src/Session/AuthBundle/Utils/Config.php index d7bc9ea..3075f9f 100644 --- a/console/skel/symfony-app/src/Session/AuthBundle/Utils/Config.php +++ b/console/skel/symfony-app/src/Session/AuthBundle/Utils/Config.php @@ -1,5 +1,6 @@ get($item->getKey(), $signalingCallback, 0); @@ -142,7 +144,8 @@ final class LockRegistry if (null !== $h = self::$openedFiles[$key] ?? null) { return $h; } - set_error_handler(function () {}); + set_error_handler(function () { + }); try { $h = fopen(self::$files[$key], 'r+'); } finally { diff --git a/console/skel/symfony/cache/Simple/ArrayCache.php b/console/skel/symfony/cache/Simple/ArrayCache.php index 7174825..8d7f5a3 100644 --- a/console/skel/symfony/cache/Simple/ArrayCache.php +++ b/console/skel/symfony/cache/Simple/ArrayCache.php @@ -82,7 +82,9 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl } } - return $this->generateItems($keys, microtime(true), function ($k, $v, $hit) use ($default) { return $hit ? $v : $default; }); + return $this->generateItems($keys, microtime(true), function ($k, $v, $hit) use ($default) { + return $hit ? $v : $default; + }); } /** diff --git a/console/skel/symfony/cache/Traits/MemcachedTrait.php b/console/skel/symfony/cache/Traits/MemcachedTrait.php index 070eb0e..6cbf674 100644 --- a/console/skel/symfony/cache/Traits/MemcachedTrait.php +++ b/console/skel/symfony/cache/Traits/MemcachedTrait.php @@ -86,7 +86,9 @@ trait MemcachedTrait if (!static::isSupported()) { throw new CacheException('Memcached >= 2.2.0 is required'); } - set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); }); + set_error_handler(function ($type, $msg, $file, $line) { + throw new \ErrorException($msg, 0, $type, $file, $line); + }); try { $options += static::$defaultClientOptions; $client = new \Memcached($options['persistent_id']); diff --git a/console/skel/symfony/cache/Traits/RedisTrait.php b/console/skel/symfony/cache/Traits/RedisTrait.php index 9b65ccb..bc783ff 100644 --- a/console/skel/symfony/cache/Traits/RedisTrait.php +++ b/console/skel/symfony/cache/Traits/RedisTrait.php @@ -61,7 +61,9 @@ trait RedisTrait if ($redisClient instanceof \Predis\ClientInterface && $redisClient->getOptions()->exceptions) { $options = clone $redisClient->getOptions(); - \Closure::bind(function () { $this->options['exceptions'] = false; }, $options, $options)(); + \Closure::bind(function () { + $this->options['exceptions'] = false; + }, $options, $options)(); $redisClient = new $redisClient($redisClient->getConnection(), $options); } @@ -177,7 +179,9 @@ trait RedisTrait throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn)); } - set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + set_error_handler(function ($type, $msg) use (&$error) { + $error = $msg; + }); $isConnected = $redis->isConnected(); restore_error_handler(); if (!$isConnected) { diff --git a/console/skel/symfony/config/Definition/Builder/ExprBuilder.php b/console/skel/symfony/config/Definition/Builder/ExprBuilder.php index bc83b76..f06b734 100644 --- a/console/skel/symfony/config/Definition/Builder/ExprBuilder.php +++ b/console/skel/symfony/config/Definition/Builder/ExprBuilder.php @@ -44,7 +44,9 @@ class ExprBuilder */ public function always(\Closure $then = null) { - $this->ifPart = function ($v) { return true; }; + $this->ifPart = function ($v) { + return true; + }; if (null !== $then) { $this->thenPart = $then; @@ -65,7 +67,9 @@ class ExprBuilder public function ifTrue(\Closure $closure = null) { if (null === $closure) { - $closure = function ($v) { return true === $v; }; + $closure = function ($v) { + return true === $v; + }; } $this->ifPart = $closure; @@ -80,7 +84,9 @@ class ExprBuilder */ public function ifString() { - $this->ifPart = function ($v) { return is_string($v); }; + $this->ifPart = function ($v) { + return is_string($v); + }; return $this; } @@ -92,7 +98,9 @@ class ExprBuilder */ public function ifNull() { - $this->ifPart = function ($v) { return null === $v; }; + $this->ifPart = function ($v) { + return null === $v; + }; return $this; } @@ -104,7 +112,9 @@ class ExprBuilder */ public function ifEmpty() { - $this->ifPart = function ($v) { return empty($v); }; + $this->ifPart = function ($v) { + return empty($v); + }; return $this; } @@ -116,7 +126,9 @@ class ExprBuilder */ public function ifArray() { - $this->ifPart = function ($v) { return is_array($v); }; + $this->ifPart = function ($v) { + return is_array($v); + }; return $this; } @@ -130,7 +142,9 @@ class ExprBuilder */ public function ifInArray(array $array) { - $this->ifPart = function ($v) use ($array) { return in_array($v, $array, true); }; + $this->ifPart = function ($v) use ($array) { + return in_array($v, $array, true); + }; return $this; } @@ -144,7 +158,9 @@ class ExprBuilder */ public function ifNotInArray(array $array) { - $this->ifPart = function ($v) use ($array) { return !in_array($v, $array, true); }; + $this->ifPart = function ($v) use ($array) { + return !in_array($v, $array, true); + }; return $this; } @@ -156,8 +172,12 @@ class ExprBuilder */ public function castToArray() { - $this->ifPart = function ($v) { return !is_array($v); }; - $this->thenPart = function ($v) { return array($v); }; + $this->ifPart = function ($v) { + return !is_array($v); + }; + $this->thenPart = function ($v) { + return array($v); + }; return $this; } @@ -183,7 +203,9 @@ class ExprBuilder */ public function thenEmptyArray() { - $this->thenPart = function ($v) { return array(); }; + $this->thenPart = function ($v) { + return array(); + }; return $this; } @@ -201,7 +223,9 @@ class ExprBuilder */ public function thenInvalid($message) { - $this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); }; + $this->thenPart = function ($v) use ($message) { + throw new \InvalidArgumentException(sprintf($message, json_encode($v))); + }; return $this; } @@ -215,7 +239,9 @@ class ExprBuilder */ public function thenUnset() { - $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); }; + $this->thenPart = function ($v) { + throw new UnsetKeyException('Unsetting key'); + }; return $this; } diff --git a/console/skel/symfony/config/Definition/EnumNode.php b/console/skel/symfony/config/Definition/EnumNode.php index 9b4c415..cbae297 100644 --- a/console/skel/symfony/config/Definition/EnumNode.php +++ b/console/skel/symfony/config/Definition/EnumNode.php @@ -47,7 +47,8 @@ class EnumNode extends ScalarNode 'The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), - implode(', ', array_map('json_encode', $this->values)))); + implode(', ', array_map('json_encode', $this->values)) + )); $ex->setPath($this->getPath()); throw $ex; diff --git a/console/skel/symfony/config/FileLocator.php b/console/skel/symfony/config/FileLocator.php index 9fc1924..b9b2de3 100644 --- a/console/skel/symfony/config/FileLocator.php +++ b/console/skel/symfony/config/FileLocator.php @@ -86,7 +86,8 @@ class FileLocator implements FileLocatorInterface private function isAbsolutePath($file) { if ($file[0] === '/' || $file[0] === '\\' - || (strlen($file) > 3 && ctype_alpha($file[0]) + || ( + strlen($file) > 3 && ctype_alpha($file[0]) && $file[1] === ':' && ($file[2] === '\\' || $file[2] === '/') ) diff --git a/console/skel/symfony/config/Loader/LoaderInterface.php b/console/skel/symfony/config/Loader/LoaderInterface.php index a097322..b230ec8 100644 --- a/console/skel/symfony/config/Loader/LoaderInterface.php +++ b/console/skel/symfony/config/Loader/LoaderInterface.php @@ -26,7 +26,7 @@ interface LoaderInterface * * @throws \Exception If something went wrong */ - public function load($resource, string $type = NULL); + public function load($resource, string $type = null); /** * Returns whether this class supports the given resource. @@ -36,7 +36,7 @@ interface LoaderInterface * * @return bool True if this class supports the given resource, false otherwise */ - public function supports($resource, string $type = NULL); + public function supports($resource, string $type = null); /** * Gets the loader resolver. diff --git a/console/skel/symfony/config/Resource/GlobResource.php b/console/skel/symfony/config/Resource/GlobResource.php index 6762520..2ad3644 100644 --- a/console/skel/symfony/config/Resource/GlobResource.php +++ b/console/skel/symfony/config/Resource/GlobResource.php @@ -101,7 +101,9 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface, $files = iterator_to_array(new \RecursiveIteratorIterator( new \RecursiveCallbackFilterIterator( new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - function (\SplFileInfo $file) { return '.' !== $file->getBasename()[0]; } + function (\SplFileInfo $file) { + return '.' !== $file->getBasename()[0]; + } ), \RecursiveIteratorIterator::LEAVES_ONLY )); diff --git a/console/skel/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php b/console/skel/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php index 99a1041..8a30f47 100644 --- a/console/skel/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/console/skel/symfony/config/Tests/Definition/Builder/ExprBuilderTest.php @@ -34,13 +34,17 @@ class ExprBuilderTest extends TestCase $this->assertFinalizedValueIs('new_value', $test, array('key' => true)); $test = $this->getTestBuilder() - ->ifTrue(function ($v) { return true; }) + ->ifTrue(function ($v) { + return true; + }) ->then($this->returnClosure('new_value')) ->end(); $this->assertFinalizedValueIs('new_value', $test); $test = $this->getTestBuilder() - ->ifTrue(function ($v) { return false; }) + ->ifTrue(function ($v) { + return false; + }) ->then($this->returnClosure('new_value')) ->end(); $this->assertFinalizedValueIs('value', $test); diff --git a/console/skel/symfony/config/Tests/Definition/Dumper/XmlReferenceDumperTest.php b/console/skel/symfony/config/Tests/Definition/Dumper/XmlReferenceDumperTest.php index fd5f9c8..38b42a1 100644 --- a/console/skel/symfony/config/Tests/Definition/Dumper/XmlReferenceDumperTest.php +++ b/console/skel/symfony/config/Tests/Definition/Dumper/XmlReferenceDumperTest.php @@ -35,7 +35,10 @@ class XmlReferenceDumperTest extends TestCase private function getConfigurationAsString() { - return str_replace("\n", PHP_EOL, <<<'EOL' + return str_replace( + "\n", + PHP_EOL, + <<<'EOL' diff --git a/console/skel/symfony/config/Tests/Definition/NormalizationTest.php b/console/skel/symfony/config/Tests/Definition/NormalizationTest.php index f011f54..c861d9f 100644 --- a/console/skel/symfony/config/Tests/Definition/NormalizationTest.php +++ b/console/skel/symfony/config/Tests/Definition/NormalizationTest.php @@ -30,7 +30,9 @@ class NormalizationTest extends TestCase ->node('encoders', 'array') ->useAttributeAsKey('class') ->prototype('array') - ->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end() + ->beforeNormalization()->ifString()->then(function ($v) { + return array('algorithm' => $v); + })->end() ->children() ->node('algorithm', 'scalar')->end() ->end() @@ -135,7 +137,9 @@ class NormalizationTest extends TestCase ), ); - return array_map(function ($v) { return array($v); }, $configs); + return array_map(function ($v) { + return array($v); + }, $configs); } /** @@ -166,7 +170,9 @@ class NormalizationTest extends TestCase ), ); - return array_map(function ($v) { return array($v); }, $configs); + return array_map(function ($v) { + return array($v); + }, $configs); } /** diff --git a/console/skel/symfony/config/Tests/Loader/FileLoaderTest.php b/console/skel/symfony/config/Tests/Loader/FileLoaderTest.php index c6e283c..d2e36ea 100644 --- a/console/skel/symfony/config/Tests/Loader/FileLoaderTest.php +++ b/console/skel/symfony/config/Tests/Loader/FileLoaderTest.php @@ -24,12 +24,12 @@ class FileLoaderTest extends TestCase $locatorMockForAdditionalLoader = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); $locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls( - array('path/to/file1'), // Default + array('path/to/file1'), // Default array('path/to/file1', 'path/to/file2'), // First is imported array('path/to/file1', 'path/to/file2'), // Second is imported array('path/to/file1'), // Exception array('path/to/file1', 'path/to/file2') // Exception - )); + )); $fileLoader = new TestFileLoader($locatorMock); $fileLoader->setSupports(false); diff --git a/console/skel/symfony/config/Tests/Loader/LoaderResolverTest.php b/console/skel/symfony/config/Tests/Loader/LoaderResolverTest.php index 0bf56b6..338d98a 100644 --- a/console/skel/symfony/config/Tests/Loader/LoaderResolverTest.php +++ b/console/skel/symfony/config/Tests/Loader/LoaderResolverTest.php @@ -34,7 +34,8 @@ class LoaderResolverTest extends TestCase $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); $resolver = new LoaderResolver(array($loader)); - $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource'); + $this->assertEquals($loader, $resolver->resolve(function () { + }), '->resolve() returns the loader for the given resource'); } public function testLoaders() diff --git a/console/skel/symfony/config/Tests/Resource/ClassExistenceResourceTest.php b/console/skel/symfony/config/Tests/Resource/ClassExistenceResourceTest.php index 3daef17..5b31e3d 100644 --- a/console/skel/symfony/config/Tests/Resource/ClassExistenceResourceTest.php +++ b/console/skel/symfony/config/Tests/Resource/ClassExistenceResourceTest.php @@ -56,7 +56,9 @@ EOF public function testExistsKo() { - spl_autoload_register($autoloader = function ($class) use (&$loadedClass) { $loadedClass = $class; }); + spl_autoload_register($autoloader = function ($class) use (&$loadedClass) { + $loadedClass = $class; + }); try { $res = new ClassExistenceResource('MissingFooClass'); diff --git a/console/skel/symfony/config/Util/XmlUtils.php b/console/skel/symfony/config/Util/XmlUtils.php index 25d9b0a..65980c6 100644 --- a/console/skel/symfony/config/Util/XmlUtils.php +++ b/console/skel/symfony/config/Util/XmlUtils.php @@ -220,7 +220,8 @@ class XmlUtils { $errors = array(); foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', + $errors[] = sprintf( + '[%s %s] %s (in %s - line %d, column %d)', LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), diff --git a/console/skel/symfony/expression-language/Tests/ExpressionLanguageTest.php b/console/skel/symfony/expression-language/Tests/ExpressionLanguageTest.php index fc2f80e..f63ed10 100644 --- a/console/skel/symfony/expression-language/Tests/ExpressionLanguageTest.php +++ b/console/skel/symfony/expression-language/Tests/ExpressionLanguageTest.php @@ -290,12 +290,16 @@ class ExpressionLanguageTest extends TestCase return [ [ function (ExpressionLanguage $el) { - $el->register('fn', function () {}, function () {}); + $el->register('fn', function () { + }, function () { + }); }, ], [ function (ExpressionLanguage $el) { - $el->addFunction(new ExpressionFunction('fn', function () {}, function () {})); + $el->addFunction(new ExpressionFunction('fn', function () { + }, function () { + })); }, ], [ diff --git a/console/skel/symfony/expression-language/Tests/ParserTest.php b/console/skel/symfony/expression-language/Tests/ParserTest.php index 2d5a0a6..09809b5 100644 --- a/console/skel/symfony/expression-language/Tests/ParserTest.php +++ b/console/skel/symfony/expression-language/Tests/ParserTest.php @@ -91,7 +91,8 @@ class ParserTest extends TestCase '3 - 3', ], [ - new Node\BinaryNode('*', + new Node\BinaryNode( + '*', new Node\BinaryNode('-', new Node\ConstantNode(3), new Node\ConstantNode(3)), new Node\ConstantNode(2) ), @@ -142,9 +143,15 @@ class ParserTest extends TestCase $this->createGetAttrNode( $this->createGetAttrNode( $this->createGetAttrNode(new Node\NameNode('foo'), 'bar', Node\GetAttrNode::METHOD_CALL), - 'foo', Node\GetAttrNode::METHOD_CALL), - 'baz', Node\GetAttrNode::PROPERTY_CALL), - '3', Node\GetAttrNode::ARRAY_CALL), + 'foo', + Node\GetAttrNode::METHOD_CALL + ), + 'baz', + Node\GetAttrNode::PROPERTY_CALL + ), + '3', + Node\GetAttrNode::ARRAY_CALL + ), 'foo.bar().foo().baz[3]', ['foo'], ], diff --git a/console/skel/symfony/filesystem/Filesystem.php b/console/skel/symfony/filesystem/Filesystem.php index 7d7301c..7788753 100644 --- a/console/skel/symfony/filesystem/Filesystem.php +++ b/console/skel/symfony/filesystem/Filesystem.php @@ -601,7 +601,8 @@ class Filesystem public function isAbsolutePath($file) { return strspn($file, '/\\', 0, 1) - || (\strlen($file) > 3 && ctype_alpha($file[0]) + || ( + \strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1) ) diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php b/console/skel/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php index 4d73b32..4cdefe2 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php @@ -94,8 +94,12 @@ abstract class AbstractFindAdapter extends AbstractAdapter $command->setErrorHandler( $this->ignoreUnreadableDirs // If directory is unreadable and finder is set to ignore it, `stderr` is ignored. - ? function ($stderr) { return; } - : function ($stderr) { throw new AccessDeniedException($stderr); } + ? function ($stderr) { + return; + } + : function ($stderr) { + throw new AccessDeniedException($stderr); + } ); $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute()); @@ -181,7 +185,8 @@ abstract class AbstractFindAdapter extends AbstractAdapter $command ->add($i > 0 ? '-or' : null) - ->add($expr->isRegex() + ->add( + $expr->isRegex() ? ($expr->isCaseSensitive() ? '-regex' : '-iregex') : ($expr->isCaseSensitive() ? '-name' : '-iname') ) @@ -223,7 +228,8 @@ abstract class AbstractFindAdapter extends AbstractAdapter $command ->add($i > 0 ? '-or' : null) - ->add($expr->isRegex() + ->add( + $expr->isRegex() ? ($expr->isCaseSensitive() ? '-regex' : '-iregex') : ($expr->isCaseSensitive() ? '-path' : '-ipath') ) diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Shell/Command.php b/console/skel/symfony/finder/Symfony/Component/Finder/Shell/Command.php index 1f69afb..edb15e5 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Shell/Command.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Shell/Command.php @@ -273,7 +273,9 @@ class Command array_map(function ($bit) { return $bit instanceof Command ? $bit->join() : ($bit ?: null); }, $this->bits), - function ($bit) { return null !== $bit; } + function ($bit) { + return null !== $bit; + } )); } diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php index 12f0678..c1789e5 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php @@ -264,7 +264,9 @@ class FinderTest extends Iterator\RealIteratorTestCase public function testSort($adapter) { $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); })); + $this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { + return strcmp($a->getRealpath(), $b->getRealpath()); + })); $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator()); } @@ -274,7 +276,9 @@ class FinderTest extends Iterator\RealIteratorTestCase public function testFilter($adapter) { $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return preg_match('/test/', $f) > 0; })); + $this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { + return preg_match('/test/', $f) > 0; + })); $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); } @@ -374,7 +378,9 @@ class FinderTest extends Iterator\RealIteratorTestCase $finder = $this->buildFinder($adapter); $a = iterator_to_array($finder->directories()->in(self::$tmpDir)); - $a = array_values(array_map(function ($a) { return (string) $a; }, $a)); + $a = array_values(array_map(function ($a) { + return (string) $a; + }, $a)); sort($a); $this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface'); } @@ -632,7 +638,9 @@ class FinderTest extends Iterator\RealIteratorTestCase public function getAdaptersTestData() { return array_map( - function ($adapter) { return array($adapter); }, + function ($adapter) { + return array($adapter); + }, $this->getValidAdapters() ); } diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php index 62629b1..a8eba76 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php @@ -38,8 +38,12 @@ class CustomFilterIteratorTest extends IteratorTestCase public function getAcceptData() { return array( - array(array(function (\SplFileInfo $fileinfo) { return false; }), array()), - array(array(function (\SplFileInfo $fileinfo) { return preg_match('/^test/', $fileinfo) > 0; }), array('test.php', 'test.py')), + array(array(function (\SplFileInfo $fileinfo) { + return false; + }), array()), + array(array(function (\SplFileInfo $fileinfo) { + return preg_match('/^test/', $fileinfo) > 0; + }), array('test.php', 'test.py')), array(array('is_dir'), array()), ); } diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php index 744bdae..7b8ad55 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php @@ -49,28 +49,32 @@ class FilecontentFilterIteratorTest extends IteratorTestCase { $inner = new MockFileListIterator(); - $inner[] = new MockSplFileInfo(array( + $inner[] = new MockSplFileInfo( + array( 'name' => 'a.txt', 'contents' => 'Lorem ipsum...', 'type' => 'file', 'mode' => 'r+', ) ); - $inner[] = new MockSplFileInfo(array( + $inner[] = new MockSplFileInfo( + array( 'name' => 'b.yml', 'contents' => 'dolor sit...', 'type' => 'file', 'mode' => 'r+', ) ); - $inner[] = new MockSplFileInfo(array( + $inner[] = new MockSplFileInfo( + array( 'name' => 'some/other/dir/third.php', 'contents' => 'amet...', 'type' => 'file', 'mode' => 'r+', ) ); - $inner[] = new MockSplFileInfo(array( + $inner[] = new MockSplFileInfo( + array( 'name' => 'unreadable-file.txt', 'contents' => false, 'type' => 'file', diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php index 029a266..7a222f0 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -24,10 +24,11 @@ class FilterIteratorTest extends RealIteratorTestCase $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i)); $i->expects($this->any()) ->method('accept') - ->will($this->returnCallback(function () use ($i) { + ->will( + $this->returnCallback(function () use ($i) { return (bool) preg_match('/\.php/', (string) $i->current()); }) - ); + ); $c = 0; foreach ($i as $item) { diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php index ae7388e..f1d1755 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php @@ -17,9 +17,13 @@ abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase { // set iterator_to_array $use_key to false to avoid values merge // this made FinderTest::testAppendWithAnArray() failed with GnuFinderAdapter - $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false)); + $values = array_map(function (\SplFileInfo $fileinfo) { + return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); + }, iterator_to_array($iterator, false)); - $expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected); + $expected = array_map(function ($path) { + return str_replace('/', DIRECTORY_SEPARATOR, $path); + }, $expected); sort($values); sort($expected); @@ -29,7 +33,9 @@ abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase protected function assertOrderedIterator($expected, \Traversable $iterator) { - $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)); + $values = array_map(function (\SplFileInfo $fileinfo) { + return $fileinfo->getPathname(); + }, iterator_to_array($iterator)); $this->assertEquals($expected, array_values($values)); } @@ -46,7 +52,9 @@ abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase */ protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator) { - $values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator))); + $values = array_values(array_map(function (\SplFileInfo $fileinfo) { + return $fileinfo->getPathname(); + }, iterator_to_array($iterator))); foreach ($expected as $subarray) { $temp = array(); diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php index eb0adfa..dbfcaf2 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php @@ -15,7 +15,9 @@ class MockFileListIterator extends \ArrayIterator { public function __construct(array $filesArray = array()) { - $files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray); + $files = array_map(function ($file) { + return new MockSplFileInfo($file); + }, $filesArray); parent::__construct($files); } } diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php index f2e8f8e..053b57d 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php @@ -96,11 +96,13 @@ class MockSplFileInfo extends \SplFileInfo switch ($type) { case 'directory': $this->type = self::TYPE_DIRECTORY; + // no break case 'd': $this->type = self::TYPE_DIRECTORY; break; case 'file': $this->type = self::TYPE_FILE; + // no break case 'f': $this->type = self::TYPE_FILE; break; diff --git a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php index e2f433f..5924ef6 100644 --- a/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php +++ b/console/skel/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php @@ -32,17 +32,17 @@ class SortableIteratorTest extends RealIteratorTestCase { if (!is_callable($mode)) { switch ($mode) { - case SortableIterator::SORT_BY_ACCESSED_TIME : + case SortableIterator::SORT_BY_ACCESSED_TIME: file_get_contents(self::toAbsolute('.git')); sleep(1); file_get_contents(self::toAbsolute('.bar')); break; - case SortableIterator::SORT_BY_CHANGED_TIME : + case SortableIterator::SORT_BY_CHANGED_TIME: file_put_contents(self::toAbsolute('test.php'), 'foo'); sleep(1); file_put_contents(self::toAbsolute('test.py'), 'foo'); break; - case SortableIterator::SORT_BY_MODIFIED_TIME : + case SortableIterator::SORT_BY_MODIFIED_TIME: file_put_contents(self::toAbsolute('test.php'), 'foo'); sleep(1); file_put_contents(self::toAbsolute('test.py'), 'foo'); @@ -163,7 +163,9 @@ class SortableIteratorTest extends RealIteratorTestCase array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)), array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)), array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)), - array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, $this->toAbsolute($customComparison)), + array(function (\SplFileInfo $a, \SplFileInfo $b) { + return strcmp($a->getRealpath(), $b->getRealpath()); + }, $this->toAbsolute($customComparison)), ); } } diff --git a/console/skel/symfony/http-foundation/File/File.php b/console/skel/symfony/http-foundation/File/File.php index 3422058..9e7f841 100644 --- a/console/skel/symfony/http-foundation/File/File.php +++ b/console/skel/symfony/http-foundation/File/File.php @@ -93,7 +93,9 @@ class File extends \SplFileInfo { $target = $this->getTargetFile($directory, $name); - set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + set_error_handler(function ($type, $msg) use (&$error) { + $error = $msg; + }); $renamed = rename($this->getPathname(), $target); restore_error_handler(); if (!$renamed) { diff --git a/console/skel/symfony/http-foundation/File/UploadedFile.php b/console/skel/symfony/http-foundation/File/UploadedFile.php index de6ce75..0d93dfb 100644 --- a/console/skel/symfony/http-foundation/File/UploadedFile.php +++ b/console/skel/symfony/http-foundation/File/UploadedFile.php @@ -192,7 +192,9 @@ class UploadedFile extends File $target = $this->getTargetFile($directory, $name); - set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + set_error_handler(function ($type, $msg) use (&$error) { + $error = $msg; + }); $moved = move_uploaded_file($this->getPathname(), $target); restore_error_handler(); if (!$moved) { diff --git a/console/skel/symfony/http-foundation/JsonResponse.php b/console/skel/symfony/http-foundation/JsonResponse.php index 5a9e755..2006907 100644 --- a/console/skel/symfony/http-foundation/JsonResponse.php +++ b/console/skel/symfony/http-foundation/JsonResponse.php @@ -123,7 +123,9 @@ class JsonResponse extends Response // PHP 5.3 triggers annoying warnings for some // types that can't be serialized as JSON (INF, resources, etc.) // but doesn't provide the JsonSerializable interface. - set_error_handler(function () { return false; }); + set_error_handler(function () { + return false; + }); $data = @json_encode($data, $this->encodingOptions); restore_error_handler(); } elseif (\PHP_VERSION_ID < 50500) { diff --git a/console/skel/symfony/http-foundation/RedirectResponse.php b/console/skel/symfony/http-foundation/RedirectResponse.php index 23eb04a..2943a3c 100644 --- a/console/skel/symfony/http-foundation/RedirectResponse.php +++ b/console/skel/symfony/http-foundation/RedirectResponse.php @@ -96,7 +96,8 @@ class RedirectResponse extends Response Redirecting to %1$s. -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); +', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')) + ); $this->headers->set('Location', $url); diff --git a/console/skel/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/console/skel/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php index 19dfe09..9f61da4 100644 --- a/console/skel/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php +++ b/console/skel/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php @@ -27,7 +27,7 @@ class MimeTypeTest extends TestCase try { $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess('-test')); chdir($cwd); - } catch(\Exception $e) { + } catch (\Exception $e) { chdir($cwd); throw $e; } diff --git a/console/skel/symfony/http-foundation/Tests/RequestTest.php b/console/skel/symfony/http-foundation/Tests/RequestTest.php index ac6f1a7..e0b79e1 100644 --- a/console/skel/symfony/http-foundation/Tests/RequestTest.php +++ b/console/skel/symfony/http-foundation/Tests/RequestTest.php @@ -218,13 +218,19 @@ class RequestTest extends TestCase $this->assertEquals(array('foo' => ''), $request->query->all()); // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory - $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), + $request = Request::create( + 'http://test.com/apparthotel-1234', + 'GET', + array(), + array(), + array(), array( 'DOCUMENT_ROOT' => '/var/www/www.test.com', 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php', 'SCRIPT_NAME' => '/app/app.php', 'PHP_SELF' => '/app/app.php/apparthotel-1234', - )); + ) + ); $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri()); $this->assertEquals('/apparthotel-1234', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); diff --git a/console/skel/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/console/skel/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index 0e0724a..9ed72f2 100644 --- a/console/skel/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/console/skel/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -106,16 +106,20 @@ class AutoExpireFlashBagTest extends TestCase ); $this->bag->initialize($array); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ), + $this->bag->peekAll() ); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ), + $this->bag->peekAll() ); } @@ -138,9 +142,11 @@ class AutoExpireFlashBagTest extends TestCase { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => array('A previous flash message'), - ), $this->bag->all() + ), + $this->bag->all() ); $this->assertEquals(array(), $this->bag->all()); diff --git a/console/skel/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/console/skel/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php index 577ff1c..49a7ffd 100644 --- a/console/skel/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ b/console/skel/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php @@ -98,9 +98,11 @@ class FlashBagTest extends TestCase { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => array('Foo'), - 'error' => array('Bar'), ), $this->bag->all() + 'error' => array('Bar'), ), + $this->bag->all() ); $this->assertEquals(array(), $this->bag->all()); @@ -141,17 +143,21 @@ class FlashBagTest extends TestCase { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => array('Foo'), 'error' => array('Bar'), - ), $this->bag->peekAll() + ), + $this->bag->peekAll() ); $this->assertTrue($this->bag->has('notice')); $this->assertTrue($this->bag->has('error')); - $this->assertEquals(array( + $this->assertEquals( + array( 'notice' => array('Foo'), 'error' => array('Bar'), - ), $this->bag->peekAll() + ), + $this->bag->peekAll() ); } diff --git a/console/skel/symfony/http-foundation/Tests/StreamedResponseTest.php b/console/skel/symfony/http-foundation/Tests/StreamedResponseTest.php index 66effe5..4eda579 100644 --- a/console/skel/symfony/http-foundation/Tests/StreamedResponseTest.php +++ b/console/skel/symfony/http-foundation/Tests/StreamedResponseTest.php @@ -19,7 +19,9 @@ class StreamedResponseTest extends TestCase { public function testConstructor() { - $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain')); + $response = new StreamedResponse(function () { + echo 'foo'; + }, 404, array('Content-Type' => 'text/plain')); $this->assertEquals(404, $response->getStatusCode()); $this->assertEquals('text/plain', $response->headers->get('Content-Type')); @@ -27,7 +29,9 @@ class StreamedResponseTest extends TestCase public function testPrepareWith11Protocol() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { + echo 'foo'; + }); $request = Request::create('/'); $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); @@ -39,7 +43,9 @@ class StreamedResponseTest extends TestCase public function testPrepareWith10Protocol() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { + echo 'foo'; + }); $request = Request::create('/'); $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0'); @@ -51,7 +57,9 @@ class StreamedResponseTest extends TestCase public function testPrepareWithHeadRequest() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123')); + $response = new StreamedResponse(function () { + echo 'foo'; + }, 200, array('Content-Length' => '123')); $request = Request::create('/', 'HEAD'); $response->prepare($request); @@ -61,7 +69,9 @@ class StreamedResponseTest extends TestCase public function testPrepareWithCacheHeaders() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public')); + $response = new StreamedResponse(function () { + echo 'foo'; + }, 200, array('Cache-Control' => 'max-age=600, public')); $request = Request::create('/', 'GET'); $response->prepare($request); @@ -72,7 +82,9 @@ class StreamedResponseTest extends TestCase { $called = 0; - $response = new StreamedResponse(function () use (&$called) { ++$called; }); + $response = new StreamedResponse(function () use (&$called) { + ++$called; + }); $response->sendContent(); $this->assertEquals(1, $called); @@ -104,19 +116,24 @@ class StreamedResponseTest extends TestCase */ public function testSetContent() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { + echo 'foo'; + }); $response->setContent('foo'); } public function testGetContent() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { + echo 'foo'; + }); $this->assertFalse($response->getContent()); } public function testCreate() { - $response = StreamedResponse::create(function () {}, 204); + $response = StreamedResponse::create(function () { + }, 204); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); $this->assertEquals(204, $response->getStatusCode()); @@ -124,18 +141,22 @@ class StreamedResponseTest extends TestCase public function testReturnThis() { - $response = new StreamedResponse(function () {}); + $response = new StreamedResponse(function () { + }); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); - $response = new StreamedResponse(function () {}); + $response = new StreamedResponse(function () { + }); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); } public function testSetNotModified() { - $response = new StreamedResponse(function () { echo 'foo'; }); + $response = new StreamedResponse(function () { + echo 'foo'; + }); $modified = $response->setNotModified(); $this->assertObjectHasAttribute('headers', $modified); $this->assertObjectHasAttribute('content', $modified); diff --git a/console/skel/symfony/polyfill-ctype/bootstrap.php b/console/skel/symfony/polyfill-ctype/bootstrap.php index 14d1d0f..a05413b 100644 --- a/console/skel/symfony/polyfill-ctype/bootstrap.php +++ b/console/skel/symfony/polyfill-ctype/bootstrap.php @@ -12,15 +12,48 @@ use Symfony\Polyfill\Ctype as p; if (!function_exists('ctype_alnum')) { - function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } - function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } - function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } - function ctype_digit($text) { return p\Ctype::ctype_digit($text); } - function ctype_graph($text) { return p\Ctype::ctype_graph($text); } - function ctype_lower($text) { return p\Ctype::ctype_lower($text); } - function ctype_print($text) { return p\Ctype::ctype_print($text); } - function ctype_punct($text) { return p\Ctype::ctype_punct($text); } - function ctype_space($text) { return p\Ctype::ctype_space($text); } - function ctype_upper($text) { return p\Ctype::ctype_upper($text); } - function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } + function ctype_alnum($text) + { + return p\Ctype::ctype_alnum($text); + } + function ctype_alpha($text) + { + return p\Ctype::ctype_alpha($text); + } + function ctype_cntrl($text) + { + return p\Ctype::ctype_cntrl($text); + } + function ctype_digit($text) + { + return p\Ctype::ctype_digit($text); + } + function ctype_graph($text) + { + return p\Ctype::ctype_graph($text); + } + function ctype_lower($text) + { + return p\Ctype::ctype_lower($text); + } + function ctype_print($text) + { + return p\Ctype::ctype_print($text); + } + function ctype_punct($text) + { + return p\Ctype::ctype_punct($text); + } + function ctype_space($text) + { + return p\Ctype::ctype_space($text); + } + function ctype_upper($text) + { + return p\Ctype::ctype_upper($text); + } + function ctype_xdigit($text) + { + return p\Ctype::ctype_xdigit($text); + } } diff --git a/console/skel/symfony/polyfill-mbstring/bootstrap.php b/console/skel/symfony/polyfill-mbstring/bootstrap.php index 204a41b..0180d5a 100644 --- a/console/skel/symfony/polyfill-mbstring/bootstrap.php +++ b/console/skel/symfony/polyfill-mbstring/bootstrap.php @@ -16,47 +16,162 @@ if (!function_exists('mb_strlen')) { define('MB_CASE_LOWER', 1); define('MB_CASE_TITLE', 2); - function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } - function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } - function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } - function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); } - function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); } - function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } - function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } - function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } - function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); } - function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); } - function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); } - function mb_parse_str($s, &$result = array()) { parse_str($s, $result); } - function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); } - function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); } - function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); } - function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); } - function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); } - function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); } - function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); } - function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); } - function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); } - function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); } - function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); } - function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); } - function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); } - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } - function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); } - function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); } - function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); } - function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); } - function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); } - function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); } + function mb_convert_encoding($s, $to, $from = null) + { + return p\Mbstring::mb_convert_encoding($s, $to, $from); + } + function mb_decode_mimeheader($s) + { + return p\Mbstring::mb_decode_mimeheader($s); + } + function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) + { + return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); + } + function mb_decode_numericentity($s, $convmap, $enc = null) + { + return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); + } + function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) + { + return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); + } + function mb_convert_case($s, $mode, $enc = null) + { + return p\Mbstring::mb_convert_case($s, $mode, $enc); + } + function mb_internal_encoding($enc = null) + { + return p\Mbstring::mb_internal_encoding($enc); + } + function mb_language($lang = null) + { + return p\Mbstring::mb_language($lang); + } + function mb_list_encodings() + { + return p\Mbstring::mb_list_encodings(); + } + function mb_encoding_aliases($encoding) + { + return p\Mbstring::mb_encoding_aliases($encoding); + } + function mb_check_encoding($var = null, $encoding = null) + { + return p\Mbstring::mb_check_encoding($var, $encoding); + } + function mb_detect_encoding($str, $encodingList = null, $strict = false) + { + return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); + } + function mb_detect_order($encodingList = null) + { + return p\Mbstring::mb_detect_order($encodingList); + } + function mb_parse_str($s, &$result = array()) + { + parse_str($s, $result); + } + function mb_strlen($s, $enc = null) + { + return p\Mbstring::mb_strlen($s, $enc); + } + function mb_strpos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); + } + function mb_strtolower($s, $enc = null) + { + return p\Mbstring::mb_strtolower($s, $enc); + } + function mb_strtoupper($s, $enc = null) + { + return p\Mbstring::mb_strtoupper($s, $enc); + } + function mb_substitute_character($char = null) + { + return p\Mbstring::mb_substitute_character($char); + } + function mb_substr($s, $start, $length = 2147483647, $enc = null) + { + return p\Mbstring::mb_substr($s, $start, $length, $enc); + } + function mb_stripos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); + } + function mb_stristr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_stristr($s, $needle, $part, $enc); + } + function mb_strrchr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); + } + function mb_strrichr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); + } + function mb_strripos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); + } + function mb_strrpos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); + } + function mb_strstr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strstr($s, $needle, $part, $enc); + } + function mb_get_info($type = 'all') + { + return p\Mbstring::mb_get_info($type); + } + function mb_http_output($enc = null) + { + return p\Mbstring::mb_http_output($enc); + } + function mb_strwidth($s, $enc = null) + { + return p\Mbstring::mb_strwidth($s, $enc); + } + function mb_substr_count($haystack, $needle, $enc = null) + { + return p\Mbstring::mb_substr_count($haystack, $needle, $enc); + } + function mb_output_handler($contents, $status) + { + return p\Mbstring::mb_output_handler($contents, $status); + } + function mb_http_input($type = '') + { + return p\Mbstring::mb_http_input($type); + } + function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) + { + return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); + } } if (!function_exists('mb_chr')) { - function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); } - function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); } - function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); } + function mb_ord($s, $enc = null) + { + return p\Mbstring::mb_ord($s, $enc); + } + function mb_chr($code, $enc = null) + { + return p\Mbstring::mb_chr($code, $enc); + } + function mb_scrub($s, $enc = null) + { + $enc = null === $enc ? mb_internal_encoding() : $enc; + return mb_convert_encoding($s, $enc, $enc); + } } if (!function_exists('mb_str_split')) { - function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); } + function mb_str_split($string, $split_length = 1, $encoding = null) + { + return p\Mbstring::mb_str_split($string, $split_length, $encoding); + } } diff --git a/console/skel/symfony/polyfill-php54/bootstrap.php b/console/skel/symfony/polyfill-php54/bootstrap.php index d72c199..5671574 100644 --- a/console/skel/symfony/polyfill-php54/bootstrap.php +++ b/console/skel/symfony/polyfill-php54/bootstrap.php @@ -13,7 +13,10 @@ use Symfony\Polyfill\Php54 as p; if (PHP_VERSION_ID < 50400) { if (!function_exists('trait_exists')) { - function trait_exists($class, $autoload = true) { return $autoload && \class_exists($class, $autoload) && false; } + function trait_exists($class, $autoload = true) + { + return $autoload && \class_exists($class, $autoload) && false; + } } if (!function_exists('class_uses')) { function class_uses($class, $autoload = true) @@ -26,9 +29,15 @@ if (PHP_VERSION_ID < 50400) { } } if (!function_exists('hex2bin')) { - function hex2bin($data) { return p\Php54::hex2bin($data); } + function hex2bin($data) + { + return p\Php54::hex2bin($data); + } } if (!function_exists('session_register_shutdown')) { - function session_register_shutdown() { register_shutdown_function('session_write_close'); } + function session_register_shutdown() + { + register_shutdown_function('session_write_close'); + } } } diff --git a/console/skel/symfony/polyfill-php55/bootstrap.php b/console/skel/symfony/polyfill-php55/bootstrap.php index 5e634fe..b63531a 100644 --- a/console/skel/symfony/polyfill-php55/bootstrap.php +++ b/console/skel/symfony/polyfill-php55/bootstrap.php @@ -13,15 +13,27 @@ use Symfony\Polyfill\Php55 as p; if (PHP_VERSION_ID < 50500) { if (!function_exists('boolval')) { - function boolval($val) { return p\Php55::boolval($val); } + function boolval($val) + { + return p\Php55::boolval($val); + } } if (!function_exists('json_last_error_msg')) { - function json_last_error_msg() { return p\Php55::json_last_error_msg(); } + function json_last_error_msg() + { + return p\Php55::json_last_error_msg(); + } } if (!function_exists('array_column')) { - function array_column($array, $columnKey, $indexKey = null) { return p\Php55ArrayColumn::array_column($array, $columnKey, $indexKey); } + function array_column($array, $columnKey, $indexKey = null) + { + return p\Php55ArrayColumn::array_column($array, $columnKey, $indexKey); + } } if (!function_exists('hash_pbkdf2')) { - function hash_pbkdf2($algorithm, $password, $salt, $iterations, $length = 0, $rawOutput = false) { return p\Php55::hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, $rawOutput); } + function hash_pbkdf2($algorithm, $password, $salt, $iterations, $length = 0, $rawOutput = false) + { + return p\Php55::hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, $rawOutput); + } } } diff --git a/console/skel/symfony/polyfill-php70/Php70.php b/console/skel/symfony/polyfill-php70/Php70.php index 7f1ad08..a010fba 100644 --- a/console/skel/symfony/polyfill-php70/Php70.php +++ b/console/skel/symfony/polyfill-php70/Php70.php @@ -53,7 +53,9 @@ final class Php70 { static $handler; if (!$handler) { - $handler = function () { return false; }; + $handler = function () { + return false; + }; } set_error_handler($handler); @trigger_error(''); diff --git a/console/skel/symfony/polyfill-php70/bootstrap.php b/console/skel/symfony/polyfill-php70/bootstrap.php index 445c398..5ca2e58 100644 --- a/console/skel/symfony/polyfill-php70/bootstrap.php +++ b/console/skel/symfony/polyfill-php70/bootstrap.php @@ -16,12 +16,21 @@ if (PHP_VERSION_ID < 70000) { define('PHP_INT_MIN', ~PHP_INT_MAX); } if (!function_exists('intdiv')) { - function intdiv($dividend, $divisor) { return p\Php70::intdiv($dividend, $divisor); } + function intdiv($dividend, $divisor) + { + return p\Php70::intdiv($dividend, $divisor); + } } if (!function_exists('preg_replace_callback_array')) { - function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) { return p\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); } + function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) + { + return p\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); + } } if (!function_exists('error_clear_last')) { - function error_clear_last() { return p\Php70::error_clear_last(); } + function error_clear_last() + { + return p\Php70::error_clear_last(); + } } } diff --git a/console/skel/symfony/routing/Router.php b/console/skel/symfony/routing/Router.php index a85fa6d..762ae28 100644 --- a/console/skel/symfony/routing/Router.php +++ b/console/skel/symfony/routing/Router.php @@ -284,7 +284,8 @@ class Router implements RouterInterface, RequestMatcherInterface return $this->matcher; } - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php', + $cache = $this->getConfigCacheFactory()->cache( + $this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php', function (ConfigCacheInterface $cache) { $dumper = $this->getMatcherDumperInstance(); if (method_exists($dumper, 'addExpressionLanguageProvider')) { @@ -323,7 +324,8 @@ class Router implements RouterInterface, RequestMatcherInterface if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) { $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger); } else { - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php', + $cache = $this->getConfigCacheFactory()->cache( + $this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php', function (ConfigCacheInterface $cache) { $dumper = $this->getGeneratorDumperInstance(); diff --git a/console/skel/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php b/console/skel/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php index b7a02b6..546ed9f 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php +++ b/console/skel/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php @@ -21,6 +21,8 @@ class CustomXmlFileLoader extends XmlFileLoader { protected function loadFile($file) { - return XmlUtils::loadFile($file, function () { return true; }); + return XmlUtils::loadFile($file, function () { + return true; + }); } } diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php index 16fcc3e..a463f06 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php @@ -31,20 +31,17 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/foo')) { // foo if (preg_match('#^/foo/(?Pbaz|symfony)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array( 'def' => 'test',)); } // foofoo if ('/foofoo' === $pathinfo) { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array( 'def' => 'test', '_route' => 'foofoo',); } - - } - - elseif (0 === strpos($pathinfo, '/bar')) { + } elseif (0 === strpos($pathinfo, '/bar')) { // bar if (preg_match('#^/bar/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array()); if (!in_array($canonicalMethod, ['GET', 'HEAD'])) { $allow = array_merge($allow, ['GET', 'HEAD']); goto not_bar; @@ -56,7 +53,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // barhead if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array()); if (!in_array($canonicalMethod, ['GET'])) { $allow = array_merge($allow, ['GET']); goto not_barhead; @@ -65,10 +62,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_barhead: - - } - - elseif (0 === strpos($pathinfo, '/test')) { + } elseif (0 === strpos($pathinfo, '/test')) { if (0 === strpos($pathinfo, '/test/baz')) { // baz if ('/test/baz' === $pathinfo) { @@ -84,17 +78,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/test/baz3/' === $pathinfo) { return ['_route' => 'baz3']; } - } // baz4 if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array()); } // baz5 if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_baz5; @@ -106,7 +99,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // baz.baz6 if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array()); if (!in_array($requestMethod, ['PUT'])) { $allow = array_merge($allow, ['PUT']); goto not_bazbaz6; @@ -115,12 +108,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_bazbaz6: - } // quoter if (preg_match('#^/(?P[\']+)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array()); } // space @@ -132,40 +124,35 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array()); } - } - - } - - elseif (0 === strpos($pathinfo, '/multi')) { + } elseif (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array( 'who' => 'World!',)); } // hey @@ -177,17 +164,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/multi/new' === $pathinfo) { return ['_route' => 'overridden2']; } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -198,9 +184,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // foo4 if (preg_match('#^/aba/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array()); } - } $host = $context->getHost(); @@ -215,7 +200,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/c2/route2' === $pathinfo) { return ['_route' => 'route2']; } - } if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -223,7 +207,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/c2/route3' === $pathinfo) { return ['_route' => 'route3']; } - } if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -231,7 +214,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/route4' === $pathinfo) { return ['_route' => 'route4']; } - } if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -239,7 +221,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if ('/route5' === $pathinfo) { return ['_route' => 'route5']; } - } // route6 @@ -251,39 +232,36 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/route1')) { // route11 if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array ()); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array()); } // route12 if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array( 'var1' => 'val',)); } - } - } if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array()); } - } // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array( 'var1' => 'val',)); } // route17 @@ -299,14 +277,13 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array()); } - } if ('/' === $pathinfo && !$allow) { diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php index 2b80be5..480cce4 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php @@ -31,20 +31,17 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/foo')) { // foo if (preg_match('#^/foo/(?Pbaz|symfony)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array( 'def' => 'test',)); } // foofoo if ('/foofoo' === $pathinfo) { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array( 'def' => 'test', '_route' => 'foofoo',); } - - } - - elseif (0 === strpos($pathinfo, '/bar')) { + } elseif (0 === strpos($pathinfo, '/bar')) { // bar if (preg_match('#^/bar/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array()); if (!in_array($canonicalMethod, ['GET', 'HEAD'])) { $allow = array_merge($allow, ['GET', 'HEAD']); goto not_bar; @@ -56,7 +53,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // barhead if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array()); if (!in_array($canonicalMethod, ['GET'])) { $allow = array_merge($allow, ['GET']); goto not_barhead; @@ -65,10 +62,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_barhead: - - } - - elseif (0 === strpos($pathinfo, '/test')) { + } elseif (0 === strpos($pathinfo, '/test')) { if (0 === strpos($pathinfo, '/test/baz')) { // baz if ('/test/baz' === $pathinfo) { @@ -94,12 +88,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_baz3: - } // baz4 if (preg_match('#^/test/(?P[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -114,7 +107,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // baz5 if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_baz5; @@ -126,7 +119,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // baz.baz6 if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array()); if (!in_array($requestMethod, ['PUT'])) { $allow = array_merge($allow, ['PUT']); goto not_bazbaz6; @@ -135,12 +128,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_bazbaz6: - } // quoter if (preg_match('#^/(?P[\']+)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array()); } // space @@ -152,40 +144,35 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array()); } - } - - } - - elseif (0 === strpos($pathinfo, '/multi')) { + } elseif (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array( 'who' => 'World!',)); } // hey @@ -207,17 +194,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/multi/new' === $pathinfo) { return ['_route' => 'overridden2']; } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -228,9 +214,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // foo4 if (preg_match('#^/aba/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array()); } - } $host = $context->getHost(); @@ -245,7 +230,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/c2/route2' === $pathinfo) { return ['_route' => 'route2']; } - } if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -253,7 +237,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/c2/route3' === $pathinfo) { return ['_route' => 'route3']; } - } if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -261,7 +244,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/route4' === $pathinfo) { return ['_route' => 'route4']; } - } if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { @@ -269,7 +251,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/route5' === $pathinfo) { return ['_route' => 'route5']; } - } // route6 @@ -281,39 +262,36 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/route1')) { // route11 if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array ()); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array()); } // route12 if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array( 'var1' => 'val',)); } - } - } if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array()); } - } // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array( 'var1' => 'val',)); } // route17 @@ -329,20 +307,19 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array()); } - } // secure if ('/secure' === $pathinfo) { $ret = ['_route' => 'secure']; - $requiredSchemes = array ( 'https' => 0,); + $requiredSchemes = array( 'https' => 0,); if (!isset($requiredSchemes[$context->getScheme()])) { if ('GET' !== $canonicalMethod) { goto not_secure; @@ -358,7 +335,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // nonsecure if ('/nonsecure' === $pathinfo) { $ret = ['_route' => 'nonsecure']; - $requiredSchemes = array ( 'http' => 0,); + $requiredSchemes = array( 'http' => 0,); if (!isset($requiredSchemes[$context->getScheme()])) { if ('GET' !== $canonicalMethod) { goto not_nonsecure; diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php index 03e540f..6f4d993 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php @@ -36,9 +36,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // dynamic if (preg_match('#^/rootprefix/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'dynamic']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'dynamic']), array()); } - } // with-condition diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php index 2585f12..297a0b1 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php @@ -100,7 +100,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_put_and_get_and_head: - } if ('/' === $pathinfo && !$allow) { diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php index ba06223..790c067 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php @@ -43,12 +43,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ('/a/333' === $pathinfo) { return ['_route' => 'a_third']; } - } // a_wildcard if (preg_match('#^/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'a_wildcard']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'a_wildcard']), array()); } if (0 === strpos($pathinfo, '/a')) { @@ -96,12 +95,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_a_sixth: - } // nested_wildcard if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'nested_wildcard']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'nested_wildcard']), array()); } if (0 === strpos($pathinfo, '/nested/group')) { @@ -149,10 +147,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_nested_c: - - } - - elseif (0 === strpos($pathinfo, '/slashed/group')) { + } elseif (0 === strpos($pathinfo, '/slashed/group')) { // slashed_a if ('/slashed/group' === $trimmedPathinfo) { $ret = ['_route' => 'slashed_a']; @@ -197,7 +192,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_slashed_c: - } if ('/' === $pathinfo && !$allow) { diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php index a668f09..2ebd774 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php @@ -69,18 +69,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_simple_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/trailing/regex')) { + } elseif (0 === strpos($pathinfo, '/trailing/regex')) { // regex_trailing_slash_no_methods if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array()); } // regex_trailing_slash_GET_method if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array()); if (!in_array($canonicalMethod, ['GET'])) { $allow = array_merge($allow, ['GET']); goto not_regex_trailing_slash_GET_method; @@ -92,7 +89,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // regex_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array()); if (!in_array($requestMethod, ['HEAD'])) { $allow = array_merge($allow, ['HEAD']); goto not_regex_trailing_slash_HEAD_method; @@ -104,7 +101,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // regex_trailing_slash_POST_method if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_regex_trailing_slash_POST_method; @@ -113,10 +110,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_regex_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { + } elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { // simple_not_trailing_slash_no_methods if ('/not-trailing/simple/no-methods' === $pathinfo) { return ['_route' => 'simple_not_trailing_slash_no_methods']; @@ -157,18 +151,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_simple_not_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { + } elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { // regex_not_trailing_slash_no_methods if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array()); } // regex_not_trailing_slash_GET_method if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array()); if (!in_array($canonicalMethod, ['GET'])) { $allow = array_merge($allow, ['GET']); goto not_regex_not_trailing_slash_GET_method; @@ -180,7 +171,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // regex_not_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array()); if (!in_array($requestMethod, ['HEAD'])) { $allow = array_merge($allow, ['HEAD']); goto not_regex_not_trailing_slash_HEAD_method; @@ -192,7 +183,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // regex_not_trailing_slash_POST_method if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_regex_not_trailing_slash_POST_method; @@ -201,7 +192,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return $ret; } not_regex_not_trailing_slash_POST_method: - } if ('/' === $pathinfo && !$allow) { diff --git a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php index c7f8852..64d8fac 100644 --- a/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php +++ b/console/skel/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php @@ -87,13 +87,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_simple_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/trailing/regex')) { + } elseif (0 === strpos($pathinfo, '/trailing/regex')) { // regex_trailing_slash_no_methods if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -108,7 +105,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // regex_trailing_slash_GET_method if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -128,7 +125,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // regex_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array()); if (!in_array($requestMethod, ['HEAD'])) { $allow = array_merge($allow, ['HEAD']); goto not_regex_trailing_slash_HEAD_method; @@ -140,7 +137,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // regex_trailing_slash_POST_method if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_regex_trailing_slash_POST_method; @@ -149,10 +146,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_regex_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { + } elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { // simple_not_trailing_slash_no_methods if ('/not-trailing/simple/no-methods' === $pathinfo) { return ['_route' => 'simple_not_trailing_slash_no_methods']; @@ -193,18 +187,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_simple_not_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { + } elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { // regex_not_trailing_slash_no_methods if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array()); } // regex_not_trailing_slash_GET_method if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array()); if (!in_array($canonicalMethod, ['GET'])) { $allow = array_merge($allow, ['GET']); goto not_regex_not_trailing_slash_GET_method; @@ -216,7 +207,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // regex_not_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array()); if (!in_array($requestMethod, ['HEAD'])) { $allow = array_merge($allow, ['HEAD']); goto not_regex_not_trailing_slash_HEAD_method; @@ -228,7 +219,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // regex_not_trailing_slash_POST_method if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array()); if (!in_array($requestMethod, ['POST'])) { $allow = array_merge($allow, ['POST']); goto not_regex_not_trailing_slash_POST_method; @@ -237,7 +228,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return $ret; } not_regex_not_trailing_slash_POST_method: - } if ('/' === $pathinfo && !$allow) { diff --git a/console/skel/symfony/routing/Tests/Generator/UrlGeneratorTest.php b/console/skel/symfony/routing/Tests/Generator/UrlGeneratorTest.php index de7c4f5..f631f52 100644 --- a/console/skel/symfony/routing/Tests/Generator/UrlGeneratorTest.php +++ b/console/skel/symfony/routing/Tests/Generator/UrlGeneratorTest.php @@ -520,17 +520,41 @@ class UrlGeneratorTest extends TestCase { $routes = $this->getRoutes('test', new Route('/{name}', [], [], [], '{locale}.example.com', ['http'])); - $this->assertSame('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' + $this->assertSame( + '//fr.example.com/app.php/Fabien', + $this->getGenerator($routes)->generate( + 'test', + ['name' => 'Fabien', 'locale' => 'fr'], + UrlGeneratorInterface::NETWORK_PATH + ), + 'network path with different host' ); - $this->assertSame('//fr.example.com/app.php/Fabien?query=string', $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate('test', - ['name' => 'Fabien', 'locale' => 'fr', 'query' => 'string'], UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context' + $this->assertSame( + '//fr.example.com/app.php/Fabien?query=string', + $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate( + 'test', + ['name' => 'Fabien', 'locale' => 'fr', 'query' => 'string'], + UrlGeneratorInterface::NETWORK_PATH + ), + 'network path although host same as context' ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, ['scheme' => 'https'])->generate('test', - ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context' + $this->assertSame( + 'http://fr.example.com/app.php/Fabien', + $this->getGenerator($routes, ['scheme' => 'https'])->generate( + 'test', + ['name' => 'Fabien', 'locale' => 'fr'], + UrlGeneratorInterface::NETWORK_PATH + ), + 'absolute URL because scheme requirement does not match context' ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested' + $this->assertSame( + 'http://fr.example.com/app.php/Fabien', + $this->getGenerator($routes)->generate( + 'test', + ['name' => 'Fabien', 'locale' => 'fr'], + UrlGeneratorInterface::ABSOLUTE_URL + ), + 'absolute URL with same scheme because it is requested' ); } @@ -545,26 +569,61 @@ class UrlGeneratorTest extends TestCase $generator = $this->getGenerator($routes, ['host' => 'example.com', 'pathInfo' => '/fabien/symfony-is-great/']); - $this->assertSame('comments', $generator->generate('comments', - ['author' => 'fabien', 'article' => 'symfony-is-great'], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + 'comments', + $generator->generate( + 'comments', + ['author' => 'fabien', 'article' => 'symfony-is-great'], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('comments?page=2', $generator->generate('comments', - ['author' => 'fabien', 'article' => 'symfony-is-great', 'page' => 2], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + 'comments?page=2', + $generator->generate( + 'comments', + ['author' => 'fabien', 'article' => 'symfony-is-great', 'page' => 2], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('../twig-is-great/', $generator->generate('article', - ['author' => 'fabien', 'article' => 'twig-is-great'], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + '../twig-is-great/', + $generator->generate( + 'article', + ['author' => 'fabien', 'article' => 'twig-is-great'], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('../../bernhard/forms-are-great/', $generator->generate('article', - ['author' => 'bernhard', 'article' => 'forms-are-great'], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + '../../bernhard/forms-are-great/', + $generator->generate( + 'article', + ['author' => 'bernhard', 'article' => 'forms-are-great'], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('//bernhard.example.com/app.php/forms-are-great', $generator->generate('host', - ['author' => 'bernhard', 'article' => 'forms-are-great'], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + '//bernhard.example.com/app.php/forms-are-great', + $generator->generate( + 'host', + ['author' => 'bernhard', 'article' => 'forms-are-great'], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('https://example.com/app.php/bernhard/blog', $generator->generate('scheme', - ['author' => 'bernhard'], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + 'https://example.com/app.php/bernhard/blog', + $generator->generate( + 'scheme', + ['author' => 'bernhard'], + UrlGeneratorInterface::RELATIVE_PATH + ) ); - $this->assertSame('../../about', $generator->generate('unrelated', - [], UrlGeneratorInterface::RELATIVE_PATH) + $this->assertSame( + '../../about', + $generator->generate( + 'unrelated', + [], + UrlGeneratorInterface::RELATIVE_PATH + ) ); } diff --git a/console/skel/symfony/routing/Tests/Loader/ClosureLoaderTest.php b/console/skel/symfony/routing/Tests/Loader/ClosureLoaderTest.php index 5d963f8..b06e3d9 100644 --- a/console/skel/symfony/routing/Tests/Loader/ClosureLoaderTest.php +++ b/console/skel/symfony/routing/Tests/Loader/ClosureLoaderTest.php @@ -22,7 +22,8 @@ class ClosureLoaderTest extends TestCase { $loader = new ClosureLoader(); - $closure = function () {}; + $closure = function () { + }; $this->assertTrue($loader->supports($closure), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); diff --git a/console/skel/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/console/skel/symfony/routing/Tests/Loader/PhpFileLoaderTest.php index 3e1f1ec..70aa34d 100644 --- a/console/skel/symfony/routing/Tests/Loader/PhpFileLoaderTest.php +++ b/console/skel/symfony/routing/Tests/Loader/PhpFileLoaderTest.php @@ -92,21 +92,31 @@ class PhpFileLoaderTest extends TestCase $expectedCollection = new RouteCollection(); - $expectedCollection->add('foo', (new Route('/foo')) + $expectedCollection->add( + 'foo', + (new Route('/foo')) ->setOptions(['utf8' => true]) ->setCondition('abc') ); - $expectedCollection->add('buz', (new Route('/zub')) + $expectedCollection->add( + 'buz', + (new Route('/zub')) ->setDefaults(['_controller' => 'foo:act']) ); - $expectedCollection->add('c_bar', (new Route('/sub/pub/bar')) + $expectedCollection->add( + 'c_bar', + (new Route('/sub/pub/bar')) ->setRequirements(['id' => '\d+']) ); - $expectedCollection->add('c_pub_buz', (new Route('/sub/pub/buz')) + $expectedCollection->add( + 'c_pub_buz', + (new Route('/sub/pub/buz')) ->setHost('host') ->setRequirements(['id' => '\d+']) ); - $expectedCollection->add('ouf', (new Route('/ouf')) + $expectedCollection->add( + 'ouf', + (new Route('/ouf')) ->setSchemes(['https']) ->setMethods(['GET']) ->setDefaults(['id' => 0]) diff --git a/console/skel/symfony/routing/Tests/RouteCollectionTest.php b/console/skel/symfony/routing/Tests/RouteCollectionTest.php index 2d29d32..21592ad 100644 --- a/console/skel/symfony/routing/Tests/RouteCollectionTest.php +++ b/console/skel/symfony/routing/Tests/RouteCollectionTest.php @@ -98,8 +98,11 @@ class RouteCollectionTest extends TestCase $collection->addCollection($collection1); $collection->add('last', $last = new Route('/last')); - $this->assertSame(['bar' => $bar, 'foo' => $foo, 'grandchild' => $grandchild, 'last' => $last], $collection->all(), - '->addCollection() imports routes of another collection, overrides if necessary and adds them at the end'); + $this->assertSame( + ['bar' => $bar, 'foo' => $foo, 'grandchild' => $grandchild, 'last' => $last], + $collection->all(), + '->addCollection() imports routes of another collection, overrides if necessary and adds them at the end' + ); } public function testAddCollectionWithResources() @@ -117,25 +120,38 @@ class RouteCollectionTest extends TestCase $collection = new RouteCollection(); $collection->add('foo', new Route('/{placeholder}')); $collection1 = new RouteCollection(); - $collection1->add('bar', new Route('/{placeholder}', - ['_controller' => 'fixed', 'placeholder' => 'default'], ['placeholder' => '.+'], ['option' => 'value']) + $collection1->add( + 'bar', + new Route( + '/{placeholder}', + ['_controller' => 'fixed', 'placeholder' => 'default'], + ['placeholder' => '.+'], + ['option' => 'value'] + ) ); $collection->addCollection($collection1); $collection->addDefaults(['placeholder' => 'new-default']); $this->assertEquals(['placeholder' => 'new-default'], $collection->get('foo')->getDefaults(), '->addDefaults() adds defaults to all routes'); - $this->assertEquals(['_controller' => 'fixed', 'placeholder' => 'new-default'], $collection->get('bar')->getDefaults(), - '->addDefaults() adds defaults to all routes and overwrites existing ones'); + $this->assertEquals( + ['_controller' => 'fixed', 'placeholder' => 'new-default'], + $collection->get('bar')->getDefaults(), + '->addDefaults() adds defaults to all routes and overwrites existing ones' + ); $collection->addRequirements(['placeholder' => '\d+']); $this->assertEquals(['placeholder' => '\d+'], $collection->get('foo')->getRequirements(), '->addRequirements() adds requirements to all routes'); - $this->assertEquals(['placeholder' => '\d+'], $collection->get('bar')->getRequirements(), - '->addRequirements() adds requirements to all routes and overwrites existing ones'); + $this->assertEquals( + ['placeholder' => '\d+'], + $collection->get('bar')->getRequirements(), + '->addRequirements() adds requirements to all routes and overwrites existing ones' + ); $collection->addOptions(['option' => 'new-value']); $this->assertEquals( ['option' => 'new-value', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'], - $collection->get('bar')->getOptions(), '->addOptions() adds options to all routes and overwrites existing ones' + $collection->get('bar')->getOptions(), + '->addOptions() adds options to all routes and overwrites existing ones' ); } @@ -180,8 +196,11 @@ class RouteCollectionTest extends TestCase $collection->addResource($bar = new FileResource(__DIR__.'/Fixtures/bar.xml')); $collection->addResource(new FileResource(__DIR__.'/Fixtures/foo.xml')); - $this->assertEquals([$foo, $bar], $collection->getResources(), - '->addResource() adds a resource and getResources() only returns unique ones by comparing the string representation'); + $this->assertEquals( + [$foo, $bar], + $collection->getResources(), + '->addResource() adds a resource and getResources() only returns unique ones by comparing the string representation' + ); } public function testUniqueRouteWithGivenName() diff --git a/console/skel/symfony/routing/Tests/RouteTest.php b/console/skel/symfony/routing/Tests/RouteTest.php index 53ae859..1d1daae 100644 --- a/console/skel/symfony/routing/Tests/RouteTest.php +++ b/console/skel/symfony/routing/Tests/RouteTest.php @@ -87,7 +87,9 @@ class RouteTest extends TestCase $this->assertEquals('bar2', $route->getDefault('foo2'), '->getDefault() return the default value'); $this->assertNull($route->getDefault('not_defined'), '->getDefault() return null if default value is not set'); - $route->setDefault('_controller', $closure = function () { return 'Hello'; }); + $route->setDefault('_controller', $closure = function () { + return 'Hello'; + }); $this->assertEquals($closure, $route->getDefault('_controller'), '->setDefault() sets a default value'); $route->setDefaults(['foo' => 'foo']); diff --git a/console/skel/symfony/service-contracts/Test/ServiceLocatorTest.php b/console/skel/symfony/service-contracts/Test/ServiceLocatorTest.php index 5ed9149..9cb6c95 100644 --- a/console/skel/symfony/service-contracts/Test/ServiceLocatorTest.php +++ b/console/skel/symfony/service-contracts/Test/ServiceLocatorTest.php @@ -27,9 +27,15 @@ abstract class ServiceLocatorTest extends TestCase public function testHas() { $locator = $this->getServiceLocator([ - 'foo' => function () { return 'bar'; }, - 'bar' => function () { return 'baz'; }, - function () { return 'dummy'; }, + 'foo' => function () { + return 'bar'; + }, + 'bar' => function () { + return 'baz'; + }, + function () { + return 'dummy'; + }, ]); $this->assertTrue($locator->has('foo')); @@ -40,8 +46,12 @@ abstract class ServiceLocatorTest extends TestCase public function testGet() { $locator = $this->getServiceLocator([ - 'foo' => function () { return 'bar'; }, - 'bar' => function () { return 'baz'; }, + 'foo' => function () { + return 'bar'; + }, + 'bar' => function () { + return 'baz'; + }, ]); $this->assertSame('bar', $locator->get('foo')); @@ -71,7 +81,9 @@ abstract class ServiceLocatorTest extends TestCase $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); } $locator = $this->getServiceLocator([ - 'foo' => function () use (&$locator) { return $locator->get('bar'); }, + 'foo' => function () use (&$locator) { + return $locator->get('bar'); + }, ]); $locator->get('foo'); @@ -82,9 +94,15 @@ abstract class ServiceLocatorTest extends TestCase $this->expectException('Psr\Container\ContainerExceptionInterface'); $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".'); $locator = $this->getServiceLocator([ - 'foo' => function () use (&$locator) { return $locator->get('bar'); }, - 'bar' => function () use (&$locator) { return $locator->get('baz'); }, - 'baz' => function () use (&$locator) { return $locator->get('bar'); }, + 'foo' => function () use (&$locator) { + return $locator->get('bar'); + }, + 'bar' => function () use (&$locator) { + return $locator->get('baz'); + }, + 'baz' => function () use (&$locator) { + return $locator->get('bar'); + }, ]); $locator->get('foo'); diff --git a/console/skel/symfony/yaml/Command/LintCommand.php b/console/skel/symfony/yaml/Command/LintCommand.php index 65ef531..a2d96a3 100644 --- a/console/skel/symfony/yaml/Command/LintCommand.php +++ b/console/skel/symfony/yaml/Command/LintCommand.php @@ -57,7 +57,8 @@ class LintCommand extends Command ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') ->addOption('parse-tags', null, InputOption::VALUE_NONE, 'Parse custom tags') - ->setHelp(<<setHelp( + <<%command.name% command lints a YAML file and outputs to STDOUT the first encountered syntax error. diff --git a/console/skel/symfony/yaml/Dumper.php b/console/skel/symfony/yaml/Dumper.php index 0b56779..8821497 100644 --- a/console/skel/symfony/yaml/Dumper.php +++ b/console/skel/symfony/yaml/Dumper.php @@ -111,7 +111,8 @@ class Dumper $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value); - $output .= sprintf('%s%s%s%s', + $output .= sprintf( + '%s%s%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $willBeInlined ? ' ' : "\n", diff --git a/public/phpinfo.php b/public/phpinfo.php index b9d7a7e..7373176 100644 --- a/public/phpinfo.php +++ b/public/phpinfo.php @@ -5,4 +5,4 @@ * Date: 05/03/2019 * Time: 10:40 */ -phpinfo(); \ No newline at end of file +phpinfo(); diff --git a/tests/Test.php b/tests/Test.php index fb990ad..0df39af 100644 --- a/tests/Test.php +++ b/tests/Test.php @@ -3,26 +3,20 @@ require_once '../public/scriptPHP/cookies.php'; class Test extends PHPUnit_Framework_TestCase { - //declaration de variables pour les fonctions de tests - public $essai; + //declaration de variables pour les fonctions de tests + public $essai; - //fonction constructeur du test (public) - public function Test() - { - - } - - //fonction de testing proprement dite - public function testOne() - { - $essai = ajouterZero(1); - - $this->assertEquals('01', $essai); - $this->assertNotEquals(10, $essai); - - } - + //fonction constructeur du test (public) + public function Test() + { + } + + //fonction de testing proprement dite + public function testOne() + { + $essai = ajouterZero(1); + + $this->assertEquals('01', $essai); + $this->assertNotEquals(10, $essai); + } } - - -?> \ No newline at end of file diff --git a/tests/fichiertest.class.php b/tests/fichiertest.class.php index dcb7983..2a87f40 100644 --- a/tests/fichiertest.class.php +++ b/tests/fichiertest.class.php @@ -5,15 +5,12 @@ include_once '../public/scriptPHP/cookies.php'; class FichierTest extends PHPUnit_Framework_TestCase { - - protected $essai; - - function testFichier(){ - $essai = ajouterZero(1); - $this->assertEquals('10', $essai); - $this->assertNotEquals(10, $essai); - } - + protected $essai; + + public function testFichier() + { + $essai = ajouterZero(1); + $this->assertEquals('10', $essai); + $this->assertNotEquals(10, $essai); + } } - -?> \ No newline at end of file