@@ -66,8 +66,6 @@ |
||
| 66 | 66 | /** |
| 67 | 67 | * Map provided log level to level code |
| 68 | 68 | * |
| 69 | - * @param string $level |
|
| 70 | - * |
|
| 71 | 69 | * @return integer |
| 72 | 70 | */ |
| 73 | 71 | protected static function getAlgorithm($algorithm) {
|
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $ttl = $configuration->get('dispatcher-cache-ttl');
|
| 43 | 43 | |
| 44 | - if ( $ttl !== null && !defined('COMODOJO_CACHE_DEFAULT_TTL') ) {
|
|
| 44 | + if ($ttl !== null && !defined('COMODOJO_CACHE_DEFAULT_TTL')) {
|
|
| 45 | 45 | |
| 46 | 46 | define('COMODOJO_CACHE_DEFAULT_TTL', $ttl);
|
| 47 | 47 | |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $folder = $configuration->get('dispatcher-cache-folder');
|
| 51 | 51 | |
| 52 | - $algorithm = self::getAlgorithm( $configuration->get('dispatcher-cache-algorithm') );
|
|
| 52 | + $algorithm = self::getAlgorithm($configuration->get('dispatcher-cache-algorithm'));
|
|
| 53 | 53 | |
| 54 | - $manager = new CacheManager( $algorithm ); |
|
| 54 | + $manager = new CacheManager($algorithm); |
|
| 55 | 55 | |
| 56 | - if ( $enabled === true ) {
|
|
| 56 | + if ($enabled === true) {
|
|
| 57 | 57 | |
| 58 | - $manager->addProvider( new FileCache($folder) ); |
|
| 58 | + $manager->addProvider(new FileCache($folder)); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | protected static function getAlgorithm($algorithm) {
|
| 74 | 74 | |
| 75 | - switch ( strtoupper($algorithm) ) {
|
|
| 75 | + switch (strtoupper($algorithm)) {
|
|
| 76 | 76 | |
| 77 | 77 | case 'PICK_LAST': |
| 78 | 78 | $selected = CacheManager::PICK_LAST; |
@@ -33,8 +33,6 @@ |
||
| 33 | 33 | /** |
| 34 | 34 | * Create the logger |
| 35 | 35 | * |
| 36 | - * @param bool $verbose |
|
| 37 | - * |
|
| 38 | 36 | * @return \Monolog\Logger |
| 39 | 37 | */ |
| 40 | 38 | public static function create(Configuration $configuration) {
|
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $enabled = $configuration->get('dispatcher-log-enabled');
|
| 45 | 45 | |
| 46 | - $level = self::getLevel( $configuration->get('dispatcher-log-level') );
|
|
| 46 | + $level = self::getLevel($configuration->get('dispatcher-log-level'));
|
|
| 47 | 47 | |
| 48 | 48 | $target = $configuration->get('dispatcher-log-target');
|
| 49 | 49 | |
| 50 | 50 | $logger = new Logger($name); |
| 51 | 51 | |
| 52 | - if ( $enabled === true ) {
|
|
| 52 | + if ($enabled === true) {
|
|
| 53 | 53 | |
| 54 | - $logger->pushHandler( new StreamHandler( $target, $level) ); |
|
| 54 | + $logger->pushHandler(new StreamHandler($target, $level)); |
|
| 55 | 55 | |
| 56 | 56 | } else {
|
| 57 | 57 | |
| 58 | - $logger->pushHandler( new NullHandler($level) ); |
|
| 58 | + $logger->pushHandler(new NullHandler($level)); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | protected static function getLevel($level) {
|
| 74 | 74 | |
| 75 | - switch ( strtoupper($level) ) {
|
|
| 75 | + switch (strtoupper($level)) {
|
|
| 76 | 76 | |
| 77 | 77 | case 'INFO': |
| 78 | 78 | $logger_level = Logger::INFO; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | //'dispatcher-autoroute' => false |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - public function __construct( $configuration = array() ) { |
|
| 46 | + public function __construct($configuration = array()) { |
|
| 47 | 47 | |
| 48 | 48 | $this->attributes['dispatcher-base-url'] = self::urlGetAbsolute(); |
| 49 | 49 | |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $value = $this->attributes[$property]; |
| 61 | 61 | |
| 62 | - if ( preg_match_all('/%(.+?)%/', $value, $matches) ) { |
|
| 62 | + if (preg_match_all('/%(.+?)%/', $value, $matches)) { |
|
| 63 | 63 | |
| 64 | 64 | $substitutions = array(); |
| 65 | 65 | |
| 66 | - foreach ( $matches as $match ) { |
|
| 66 | + foreach ($matches as $match) { |
|
| 67 | 67 | |
| 68 | 68 | $backreference = $match[1]; |
| 69 | 69 | |
| 70 | - if ( $backreference != $property && !isset($substitutions['/%'.$backreference.'%/']) ) { |
|
| 70 | + if ($backreference != $property && !isset($substitutions['/%'.$backreference.'%/'])) { |
|
| 71 | 71 | |
| 72 | 72 | $substitutions['/%'.$backreference.'%/'] = $this->$backreference; |
| 73 | 73 | |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | private static function urlGetAbsolute() { |
| 113 | 113 | |
| 114 | - $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://'; |
|
| 114 | + $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'; |
|
| 115 | 115 | |
| 116 | 116 | $uri = preg_replace("/\/index.php(.*?)$/i", "", $_SERVER['PHP_SELF']); |
| 117 | 117 | |
| 118 | - return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" ); |
|
| 118 | + return ($http.$_SERVER['HTTP_HOST'].$uri."/"); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $this->extra = new Extra($this->logger); |
| 87 | 87 | |
| 88 | - $this->router->load( $routing_table ); |
|
| 88 | + $this->router->load($routing_table); |
|
| 89 | 89 | |
| 90 | 90 | } |
| 91 | 91 | |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function dispatch() { |
| 135 | 135 | |
| 136 | - $this->events->emit( new DispatcherEvent($this) ); |
|
| 136 | + $this->events->emit(new DispatcherEvent($this)); |
|
| 137 | 137 | |
| 138 | - if ( $this->configuration()->get('dispatcher-enabled') === false ) { |
|
| 138 | + if ($this->configuration()->get('dispatcher-enabled') === false) { |
|
| 139 | 139 | |
| 140 | 140 | $status = $this->configuration()->get('dispatcher-disabled-status'); |
| 141 | 141 | |
@@ -147,31 +147,31 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | } else { |
| 149 | 149 | |
| 150 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') ); |
|
| 150 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request')); |
|
| 151 | 151 | |
| 152 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get()) ); |
|
| 152 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get())); |
|
| 153 | 153 | |
| 154 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') ); |
|
| 154 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#')); |
|
| 155 | 155 | |
| 156 | 156 | $this->router->route($this->request); |
| 157 | 157 | |
| 158 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') ); |
|
| 158 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route')); |
|
| 159 | 159 | |
| 160 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType()) ); |
|
| 160 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType())); |
|
| 161 | 161 | |
| 162 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService()) ); |
|
| 162 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService())); |
|
| 163 | 163 | |
| 164 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') ); |
|
| 164 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#')); |
|
| 165 | 165 | |
| 166 | 166 | // translate route to service |
| 167 | 167 | |
| 168 | 168 | $this->router->compose($this->response); |
| 169 | 169 | |
| 170 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') ); |
|
| 170 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response')); |
|
| 171 | 171 | |
| 172 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()) ); |
|
| 172 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get())); |
|
| 173 | 173 | |
| 174 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') ); |
|
| 174 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#')); |
|
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |