@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace WebStream\Annotation; |
| 3 | 3 | |
| 4 | -use WebStream\Core\CoreInterface; |
|
| 5 | 4 | use WebStream\Annotation\Base\Annotation; |
| 6 | 5 | use WebStream\Annotation\Base\IAnnotatable; |
| 7 | 6 | use WebStream\Annotation\Base\IRead; |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | /** |
| 51 | 51 | * {@inheritdoc} |
| 52 | 52 | */ |
| 53 | - public function onMethodInject(IAnnotatable &$instance, Container $container, \ReflectionMethod $method) |
|
| 53 | + public function onMethodInject(IAnnotatable&$instance, Container $container, \ReflectionMethod $method) |
|
| 54 | 54 | { |
| 55 | 55 | $this->injectedLog($this); |
| 56 | 56 | |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace WebStream\Annotation; |
| 3 | 3 | |
| 4 | -use WebStream\Core\CoreInterface; |
|
| 5 | 4 | use WebStream\Annotation\Base\Annotation; |
| 6 | 5 | use WebStream\Annotation\Base\IAnnotatable; |
| 7 | 6 | use WebStream\Annotation\Base\IRead; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * {@inheritdoc} |
| 54 | 54 | */ |
| 55 | - public function onMethodInject(IAnnotatable &$instance, Container $container, \ReflectionMethod $method) |
|
| 55 | + public function onMethodInject(IAnnotatable&$instance, Container $container, \ReflectionMethod $method) |
|
| 56 | 56 | { |
| 57 | 57 | $this->injectedLog($this); |
| 58 | 58 | |
| 59 | - $key = $method->class . "#" . $method->name; |
|
| 59 | + $key = $method->class."#".$method->name; |
|
| 60 | 60 | if ($this->injectedContainer->{$key} === null) { |
| 61 | 61 | $this->injectedContainer->{$key} = new AnnotationListContainer(); |
| 62 | 62 | } |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | $files = [$files]; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $this->injectedContainer->{$key}->pushAsLazy(function () use ($files) { |
|
| 68 | + $this->injectedContainer->{$key}->pushAsLazy(function() use ($files) { |
|
| 69 | 69 | $xmlObjectList = []; |
| 70 | 70 | foreach ($files as $file) { |
| 71 | 71 | if (file_exists($file)) { |
| 72 | 72 | $xmlObject = simplexml_load_file($file); |
| 73 | 73 | if ($xmlObject === false) { |
| 74 | - throw new DatabaseException("Failded to parse query file: " . $file); |
|
| 74 | + throw new DatabaseException("Failded to parse query file: ".$file); |
|
| 75 | 75 | } |
| 76 | 76 | $xmlObjectList[] = $xmlObject; |
| 77 | 77 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * constructor |
| 57 | 57 | * @param IAnnotatable アノテーション使用可能インスタンス |
| 58 | - * @param Container 依存コンテナ |
|
| 58 | + * @param Container Container |
|
| 59 | 59 | */ |
| 60 | 60 | public function __construct(IAnnotatable &$instance, Container $container) |
| 61 | 61 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param IAnnotatable アノテーション使用可能インスタンス |
| 58 | 58 | * @param Container 依存コンテナ |
| 59 | 59 | */ |
| 60 | - public function __construct(IAnnotatable &$instance, Container $container) |
|
| 60 | + public function __construct(IAnnotatable&$instance, Container $container) |
|
| 61 | 61 | { |
| 62 | 62 | $this->instance = $instance; |
| 63 | 63 | $this->container = $container; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $annotation->onPropertyInject($this->instance, $this->container, $property); |
| 253 | 253 | } catch (\Exception $e) { |
| 254 | 254 | if ($this->exception === null) { |
| 255 | - $this->exception = function () use ($e) { |
|
| 255 | + $this->exception = function() use ($e) { |
|
| 256 | 256 | throw $e; |
| 257 | 257 | }; |
| 258 | 258 | } |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace WebStream\Annotation; |
| 3 | 3 | |
| 4 | -use WebStream\Core\CoreInterface; |
|
| 5 | 4 | use WebStream\Annotation\Base\Annotation; |
| 6 | 5 | use WebStream\Annotation\Base\IAnnotatable; |
| 7 | 6 | use WebStream\Annotation\Base\IMethod; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * {@inheritdoc} |
| 55 | 55 | */ |
| 56 | - public function onMethodInject(IAnnotatable &$instance, Container $container, \ReflectionMethod $method) |
|
| 56 | + public function onMethodInject(IAnnotatable&$instance, Container $container, \ReflectionMethod $method) |
|
| 57 | 57 | { |
| 58 | 58 | $this->injectedLog($this); |
| 59 | 59 | |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (PHP_OS === "WIN32" || PHP_OS === "WINNT") { |
| 66 | 66 | if (preg_match("/^.*[. ]|.*[\p{Cntrl}\/:*?\"<>|].*|(?i:CON|PRN|AUX|CLOCK\$|NUL|COM[1-9]|LPT[1-9])(?:[.].+)?$/", $filename)) { |
| 67 | - throw new AnnotationException("Invalid string contains in @Template('" . safetyOut($filename) . "')"); |
|
| 67 | + throw new AnnotationException("Invalid string contains in @Template('".safetyOut($filename)."')"); |
|
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | 70 | if (preg_match("/:|\.\.\/|\.\.\\\\/", $filename)) { |
| 71 | - throw new AnnotationException("Invalid string contains in @Template('" . safetyOut($filename) . "')"); |
|
| 71 | + throw new AnnotationException("Invalid string contains in @Template('".safetyOut($filename)."')"); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($filename === null) { |
| 76 | - $errorMsg = "Invalid argument of @Template('" . safetyOut($filename) . "'). "; |
|
| 77 | - $errorMsg.= "There is no specification of the base template."; |
|
| 76 | + $errorMsg = "Invalid argument of @Template('".safetyOut($filename)."'). "; |
|
| 77 | + $errorMsg .= "There is no specification of the base template."; |
|
| 78 | 78 | throw new AnnotationException($errorMsg); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | if ($engine === "twig") { |
| 84 | 84 | if (!is_bool($debug)) { |
| 85 | 85 | if ($debug !== null) { |
| 86 | - $errorMsg = "Invalid argument of @Template('" . safetyOut($filename) . "'). "; |
|
| 87 | - $errorMsg.= "'debug' attribute bool only be specified."; |
|
| 86 | + $errorMsg = "Invalid argument of @Template('".safetyOut($filename)."'). "; |
|
| 87 | + $errorMsg .= "'debug' attribute bool only be specified."; |
|
| 88 | 88 | throw new AnnotationException($errorMsg); |
| 89 | 89 | } |
| 90 | 90 | $debug = false; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $cacheTime = intval($cacheTime); |
| 117 | 117 | if ($cacheTime <= 0) { |
| 118 | - $errorMsg = "Expire value is out of integer range: @Template(cacheTime=" . strval($cacheTime) . ")"; |
|
| 118 | + $errorMsg = "Expire value is out of integer range: @Template(cacheTime=".strval($cacheTime).")"; |
|
| 119 | 119 | throw new AnnotationException($errorMsg); |
| 120 | 120 | } elseif ($cacheTime >= PHP_INT_MAX) { |
| 121 | 121 | $this->logger->warn("Expire value converted the maximum of PHP Integer."); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $this->injectedContainer->engine = new Basic($container); |
| 128 | 128 | } else { |
| 129 | - $errorMsg = "Invalid 'engine' attribute of @Template('" . safetyOut($filename) . "'."; |
|
| 129 | + $errorMsg = "Invalid 'engine' attribute of @Template('".safetyOut($filename)."'."; |
|
| 130 | 130 | throw new AnnotationException($errorMsg); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace WebStream\Annotation; |
| 3 | 3 | |
| 4 | -use WebStream\Core\CoreInterface; |
|
| 5 | 4 | use WebStream\Annotation\Base\Annotation; |
| 6 | 5 | use WebStream\Annotation\Base\IAnnotatable; |
| 7 | 6 | use WebStream\Annotation\Base\IMethod; |
@@ -10,7 +9,6 @@ discard block |
||
| 10 | 9 | use WebStream\Module\Utility\CommonUtils; |
| 11 | 10 | use WebStream\Module\Utility\ApplicationUtils; |
| 12 | 11 | use WebStream\Module\ClassLoader; |
| 13 | -use WebStream\DI\ServiceLocator; |
|
| 14 | 12 | use WebStream\Exception\Extend\ValidateException; |
| 15 | 13 | use WebStream\Exception\Extend\AnnotationException; |
| 16 | 14 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * {@inheritdoc} |
| 46 | 46 | */ |
| 47 | - public function onMethodInject(IAnnotatable &$instance, Container $container, \ReflectionMethod $method) |
|
| 47 | + public function onMethodInject(IAnnotatable&$instance, Container $container, \ReflectionMethod $method) |
|
| 48 | 48 | { |
| 49 | 49 | $this->injectedLog($this); |
| 50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->injectedContainer->isValid = false; |
| 56 | 56 | |
| 57 | 57 | if ($method !== null && !$this->inArray($method, ["get", "post", "put", "delete"])) { |
| 58 | - $errorMsg = "Invalid method attribute is specified: " . safetyOut($method); |
|
| 58 | + $errorMsg = "Invalid method attribute is specified: ".safetyOut($method); |
|
| 59 | 59 | throw new AnnotationException($errorMsg); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -68,35 +68,35 @@ discard block |
||
| 68 | 68 | ->inject('applicationInfo', $container->applicationInfo); |
| 69 | 69 | |
| 70 | 70 | // デフォルトバリデーションルールのパス |
| 71 | - $filepath = $container->applicationInfo->validateRuleDir . $className . ".php"; |
|
| 71 | + $filepath = $container->applicationInfo->validateRuleDir.$className.".php"; |
|
| 72 | 72 | if (!$classLoader->import($filepath)) { |
| 73 | 73 | $loadList = $classLoader->load($className); |
| 74 | 74 | // バリデーションルールのクラス名が複数指定されている場合は適用判断不可能なのでエラー |
| 75 | 75 | if (count($loadList) >= 2) { |
| 76 | - $errorMsg = "Class load failed because the same class name has been identified: " . $className . ""; |
|
| 76 | + $errorMsg = "Class load failed because the same class name has been identified: ".$className.""; |
|
| 77 | 77 | throw new ValidateException($errorMsg); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if (count($loadList) === 0) { |
| 81 | - $errorMsg = "Invalid Validate class filepath: " . $filepath . ""; |
|
| 81 | + $errorMsg = "Invalid Validate class filepath: ".$filepath.""; |
|
| 82 | 82 | throw new ValidateException($errorMsg); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $namespace = $this->getNamespace($loadList[0]); |
| 86 | - $classpath = $namespace . "\\" . $className; |
|
| 86 | + $classpath = $namespace."\\".$className; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $root = $container->applicationInfo->applicationRoot; |
| 90 | - $classpath = $classpath ?: $this->getNamespace($root . "/" . $filepath) . "\\" . $className; |
|
| 90 | + $classpath = $classpath ?: $this->getNamespace($root."/".$filepath)."\\".$className; |
|
| 91 | 91 | |
| 92 | 92 | if (!class_exists($classpath)) { |
| 93 | - $errorMsg = "Invalid Validate class's classpath: " . $classpath; |
|
| 93 | + $errorMsg = "Invalid Validate class's classpath: ".$classpath; |
|
| 94 | 94 | throw new AnnotationException($errorMsg); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $validateInstance = new $classpath(); |
| 98 | 98 | if ($validateInstance instanceof WebStream\Validate\IValidate) { |
| 99 | - $errorMsg = get_class($validateInstance) . " must be IValidate instance."; |
|
| 99 | + $errorMsg = get_class($validateInstance)." must be IValidate instance."; |
|
| 100 | 100 | throw new AnnotationException($errorMsg); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $params = $container->request->delete; |
| 119 | 119 | } |
| 120 | 120 | } else { |
| 121 | - $errorMsg = "Unsupported method is specified: " . safetyOut($method); |
|
| 121 | + $errorMsg = "Unsupported method is specified: ".safetyOut($method); |
|
| 122 | 122 | throw new AnnotationException($errorMsg); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | $value = is_array($params) && array_key_exists($key, $params) ? $params[$key] : null; |
| 128 | 128 | |
| 129 | 129 | if (!$validateInstance->isValid($value, $rule)) { |
| 130 | - $errorMsg = "Validation rule error. Rule is '$rule', value is " . (safetyOut($value) ?: "null"); |
|
| 130 | + $errorMsg = "Validation rule error. Rule is '$rule', value is ".(safetyOut($value) ?: "null"); |
|
| 131 | 131 | throw new ValidateException($errorMsg); |
| 132 | 132 | } |
| 133 | 133 | } else { |
| 134 | - $errorMsg = "Invalid validation rule definition: " . $rule; |
|
| 134 | + $errorMsg = "Invalid validation rule definition: ".$rule; |
|
| 135 | 135 | throw new ValidateException($errorMsg); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * アプリケーション共通で使用するクラスを初期化する |
| 26 | - * @param Container DIコンテナ |
|
| 26 | + * @param Container Container |
|
| 27 | 27 | */ |
| 28 | 28 | public function __construct(Container $container) |
| 29 | 29 | { |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use WebStream\Exception\ApplicationException; |
| 7 | 7 | use WebStream\Exception\SystemException; |
| 8 | 8 | use WebStream\Exception\DelegateException; |
| 9 | -use WebStream\DI\ServiceLocator; |
|
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * Applicationクラス |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use WebStream\Annotation\Filter; |
| 8 | 8 | use WebStream\Annotation\Base\IAnnotatable; |
| 9 | 9 | use WebStream\Database\DatabaseManager; |
| 10 | -use WebStream\Database\Result; |
|
| 11 | 10 | use WebStream\Exception\Extend\DatabaseException; |
| 12 | 11 | use WebStream\Exception\Extend\MethodNotFoundException; |
| 13 | 12 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $result = $this->manager->query($sql)->{$method}(); |
| 165 | 165 | } |
| 166 | 166 | } else { |
| 167 | - throw new DatabaseException("Invalid SQL or bind parameters: " . $sql .", " . strval($bind)); |
|
| 167 | + throw new DatabaseException("Invalid SQL or bind parameters: ".$sql.", ".strval($bind)); |
|
| 168 | 168 | } |
| 169 | 169 | } else { |
| 170 | 170 | $bind = null; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $queryKey = $this->classpath . "#" . $modelMethod; |
|
| 188 | + $queryKey = $this->classpath."#".$modelMethod; |
|
| 189 | 189 | $queryId = $method; |
| 190 | 190 | |
| 191 | 191 | $refClass = new \ReflectionClass($this); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | if ($entityClassPath !== null) { |
| 226 | 226 | if (!class_exists($entityClassPath)) { |
| 227 | - throw new DatabaseException("Entity classpath is not found: " . $entityClassPath); |
|
| 227 | + throw new DatabaseException("Entity classpath is not found: ".$entityClassPath); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | switch ($method) { |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | $result = $this->manager->query($sql)->select()->toEntity($entityClassPath); |
| 237 | 237 | } |
| 238 | 238 | } else { |
| 239 | - $errorMessage = "Invalid SQL or bind parameters: " . $sql; |
|
| 239 | + $errorMessage = "Invalid SQL or bind parameters: ".$sql; |
|
| 240 | 240 | if (is_array($bind)) { |
| 241 | - $errorMessage .= ", " . strval($bind); |
|
| 241 | + $errorMessage .= ", ".strval($bind); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | throw new DatabaseException($errorMessage); |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | $result = $this->manager->query($sql)->{$method}(); |
| 263 | 263 | } |
| 264 | 264 | } else { |
| 265 | - $errorMessage = "Invalid SQL or bind parameters: " . $sql; |
|
| 265 | + $errorMessage = "Invalid SQL or bind parameters: ".$sql; |
|
| 266 | 266 | if (is_array($bind)) { |
| 267 | - $errorMessage .= ", " . strval($bind); |
|
| 267 | + $errorMessage .= ", ".strval($bind); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | throw new DatabaseException($errorMessage); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * constructor |
| 27 | - * @param Container 依存コンテナ |
|
| 27 | + * @param Container Container |
|
| 28 | 28 | */ |
| 29 | 29 | public function __construct(Container $container) |
| 30 | 30 | { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * 初期処理 |
| 56 | - * @param Container 依存コンテナ |
|
| 56 | + * @param Container Container |
|
| 57 | 57 | */ |
| 58 | 58 | private function initialize(Container $container) |
| 59 | 59 | { |
@@ -77,14 +77,14 @@ |
||
| 77 | 77 | $dsnHash = ""; |
| 78 | 78 | $databaseConfigContainer = new Container(false); |
| 79 | 79 | foreach ($config as $key => $value) { |
| 80 | - $dsnHash .= $key . $value; |
|
| 80 | + $dsnHash .= $key.$value; |
|
| 81 | 81 | $databaseConfigContainer->set($key, $value); |
| 82 | 82 | } |
| 83 | 83 | $dsnHash = md5($dsnHash); |
| 84 | 84 | |
| 85 | 85 | $this->classpathMap[$container->filepath] = $dsnHash; |
| 86 | 86 | |
| 87 | - $this->connectionContainer->{$dsnHash} = function () use ($driverClassPath, $databaseConfigContainer, $logger) { |
|
| 87 | + $this->connectionContainer->{$dsnHash} = function() use ($driverClassPath, $databaseConfigContainer, $logger) { |
|
| 88 | 88 | $driver = new $driverClassPath($databaseConfigContainer); |
| 89 | 89 | $driver->inject('logger', $logger); |
| 90 | 90 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * constructor |
| 40 | - * @param Container 依存コンテナ |
|
| 40 | + * @param Container Container |
|
| 41 | 41 | */ |
| 42 | 42 | public function __construct(Container $container) |
| 43 | 43 | { |
@@ -183,6 +183,7 @@ discard block |
||
| 183 | 183 | * クエリを設定する |
| 184 | 184 | * @param string SQL |
| 185 | 185 | * @param array<string> パラメータ |
| 186 | + * @param string $sql |
|
| 186 | 187 | */ |
| 187 | 188 | public function query($sql, array $bind = []) |
| 188 | 189 | { |