@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return OptionTrait |
| 49 | 49 | */ |
| 50 | 50 | public function dropOption($key) { |
| 51 | - if(array_key_exists($key, $this->options)) { |
|
| 51 | + if (array_key_exists($key, $this->options)) { |
|
| 52 | 52 | unset($this->options[$key]); |
| 53 | 53 | } |
| 54 | 54 | return $this; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @return mixed|null |
| 60 | 60 | */ |
| 61 | 61 | public function getOption($key) { |
| 62 | - if(array_key_exists($key, $this->options)) { |
|
| 62 | + if (array_key_exists($key, $this->options)) { |
|
| 63 | 63 | return $this->options[$key]; |
| 64 | 64 | } |
| 65 | 65 | return null; |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | protected $isMultipart = false; |
| 73 | 73 | |
| 74 | 74 | protected function closeConnection() { |
| 75 | - if(null !== $this->con) { |
|
| 76 | - if(is_resource($this->con)) { |
|
| 75 | + if (null !== $this->con) { |
|
| 76 | + if (is_resource($this->con)) { |
|
| 77 | 77 | curl_close($this->con); |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $this->setCon(null); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $this->params = []; |
| 92 | 92 | $this->headers = []; |
| 93 | 93 | $this->debug = 'debug' === strtolower(Config::getParam('log.level', 'notice')); |
| 94 | - Logger::log('Context service for ' . static::class . ' cleared!'); |
|
| 94 | + Logger::log('Context service for '.static::class.' cleared!'); |
|
| 95 | 95 | $this->closeConnection(); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $this->clearContext(); |
| 101 | 101 | $con = curl_init($this->url); |
| 102 | - if(is_resource($con)) { |
|
| 102 | + if (is_resource($con)) { |
|
| 103 | 103 | $this->setCon($con); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function setUrl($url, $cleanContext = true) |
| 120 | 120 | { |
| 121 | 121 | $this->url = $url; |
| 122 | - if($cleanContext) { |
|
| 122 | + if ($cleanContext) { |
|
| 123 | 123 | $this->initialize(); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function setIsJson($isJson = true) { |
| 186 | 186 | $this->isJson = $isJson; |
| 187 | - if($isJson) { |
|
| 187 | + if ($isJson) { |
|
| 188 | 188 | $this->setIsMultipart(false); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function setIsMultipart($isMultipart = true) { |
| 203 | 203 | $this->isMultipart = $isMultipart; |
| 204 | - if($isMultipart) { |
|
| 204 | + if ($isMultipart) { |
|
| 205 | 205 | $this->setIsJson(false); |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace PSFS\base\types\traits; |
| 3 | 3 | |
| 4 | -if(!defined('PSFS_BOOSTRAP_TRAT_LOADED')) { |
|
| 4 | +if (!defined('PSFS_BOOSTRAP_TRAT_LOADED')) { |
|
| 5 | 5 | /** |
| 6 | 6 | * Class BoostrapTrait |
| 7 | 7 | * @package PSFS\base\types |
@@ -10,5 +10,5 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | } |
| 12 | 12 | define('PSFS_BOOSTRAP_TRAT_LOADED', true); |
| 13 | - require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
| 13 | + require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
| 14 | 14 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | if (preg_match('/^asc$/i', $direction)) { |
| 64 | 64 | return self::ASC; |
| 65 | - } else { |
|
| 65 | + }else { |
|
| 66 | 66 | return self::DESC; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function fromArray(array $object = []) |
| 83 | 83 | { |
| 84 | - foreach($object as $field => $order) { |
|
| 84 | + foreach ($object as $field => $order) { |
|
| 85 | 85 | $this->addOrder($field, $order); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $router->simpatize(); |
| 58 | 58 | Security::getInstance()->setFlash("callback_message", t("Rutas generadas correctamente")); |
| 59 | 59 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
| 60 | - } catch (Exception $e) { |
|
| 60 | + }catch (Exception $e) { |
|
| 61 | 61 | Logger::log($e->getMessage(), LOG_ERR); |
| 62 | 62 | Security::getInstance()->setFlash("callback_message", t("Algo no ha salido bien, revisa los logs")); |
| 63 | 63 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | foreach ($domains as $domain => $routes) { |
| 34 | 34 | $pDomain = str_replace('@', '', $domain); |
| 35 | 35 | $pDomain = str_replace('/', '', $pDomain); |
| 36 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
| 36 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
| 37 | 37 | } |
| 38 | 38 | return $this->json($response); |
| 39 | 39 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function config() |
| 51 | 51 | { |
| 52 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
| 52 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
| 53 | 53 | /* @var $form ConfigForm */ |
| 54 | 54 | $form = new ConfigForm(Router::getInstance()->getRoute('admin-config'), Config::$required, Config::$optional, Config::getInstance()->dumpConfig()); |
| 55 | 55 | $form->build(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
| 88 | 88 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
| 89 | - } else { |
|
| 89 | + }else { |
|
| 90 | 90 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function generateModule() |
| 36 | 36 | { |
| 37 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
| 37 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
| 38 | 38 | /* @var $form ConfigForm */ |
| 39 | 39 | $form = new ModuleForm(); |
| 40 | 40 | $form->build(); |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
| 67 | 67 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente"))); |
| 68 | 68 | // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
| 69 | - } catch (Exception $e) { |
|
| 70 | - Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
| 69 | + }catch (Exception $e) { |
|
| 70 | + Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
| 71 | 71 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct() |
| 28 | 28 | { |
| 29 | - Logger::log(static::class . ' constructor invoked'); |
|
| 29 | + Logger::log(static::class.' constructor invoked'); |
|
| 30 | 30 | $this->init(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | $calledClass = static::class; |
| 86 | 86 | try { |
| 87 | 87 | $instance = InjectorHelper::constructInjectableInstance($variable, $singleton, $classNameSpace, $calledClass); |
| 88 | - $setter = 'set' . ucfirst($variable); |
|
| 88 | + $setter = 'set'.ucfirst($variable); |
|
| 89 | 89 | if (method_exists($calledClass, $setter)) { |
| 90 | 90 | $this->$setter($instance); |
| 91 | - } else { |
|
| 91 | + }else { |
|
| 92 | 92 | $this->$variable = $instance; |
| 93 | 93 | } |
| 94 | - } catch (Exception $e) { |
|
| 95 | - Logger::log($e->getMessage() . ': ' . $e->getFile() . ' [' . $e->getLine() . ']', LOG_ERR); |
|
| 94 | + }catch (Exception $e) { |
|
| 95 | + Logger::log($e->getMessage().': '.$e->getFile().' ['.$e->getLine().']', LOG_ERR); |
|
| 96 | 96 | throw $e; |
| 97 | 97 | } |
| 98 | 98 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | if (!$this->isLoaded()) { |
| 109 | 109 | $filename = sha1(get_class($this)); |
| 110 | - $cacheFilename = 'reflections' . DIRECTORY_SEPARATOR . substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2) . DIRECTORY_SEPARATOR . $filename . '.json'; |
|
| 110 | + $cacheFilename = 'reflections'.DIRECTORY_SEPARATOR.substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2).DIRECTORY_SEPARATOR.$filename.'.json'; |
|
| 111 | 111 | /** @var Cache $cacheService */ |
| 112 | 112 | $cacheService = Cache::getInstance(); |
| 113 | 113 | /** @var Config $configService */ |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | $this->setLoaded(); |
| 128 | - } else { |
|
| 129 | - Logger::log(get_class($this) . ' already loaded', LOG_INFO); |
|
| 128 | + }else { |
|
| 129 | + Logger::log(get_class($this).' already loaded', LOG_INFO); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function getServer($key, $default = null) |
| 22 | 22 | { |
| 23 | 23 | $value = null; |
| 24 | - if(array_key_exists($key, $this->server)) { |
|
| 24 | + if (array_key_exists($key, $this->server)) { |
|
| 25 | 25 | $value = $this->server[$key]; |
| 26 | 26 | } |
| 27 | 27 | return $value ?: $default; |