@@ -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 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | use WebStream\Module\Security; |
10 | -use WebStream\DI\ServiceLocator; |
|
11 | 10 | use WebStream\Log\Logger; |
12 | 11 | |
13 | 12 | /** |
@@ -79,7 +79,7 @@ |
||
79 | 79 | public function shutdownHandler() |
80 | 80 | { |
81 | 81 | if ($error = error_get_last()) { |
82 | - $errorMsg = $error['message'] . " " . $error['file'] . "(" . $error['line'] . ")"; |
|
82 | + $errorMsg = $error['message']." ".$error['file']."(".$error['line'].")"; |
|
83 | 83 | switch ($error['type']) { |
84 | 84 | case E_ERROR: |
85 | 85 | case E_CORE_ERROR: |
@@ -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 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * {@inheritdoc} |
|
62 | + * {@inheritdoc} |
|
63 | 63 | */ |
64 | 64 | public function __customAnnotation(array $annotation) |
65 | 65 | { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $result = $this->manager->query($sql)->{$method}(); |
155 | 155 | } |
156 | 156 | } else { |
157 | - throw new DatabaseException("Invalid SQL or bind parameters: " . $sql .", " . strval($bind)); |
|
157 | + throw new DatabaseException("Invalid SQL or bind parameters: ".$sql.", ".strval($bind)); |
|
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | $bind = null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | $namespace = substr($this->getNamespace($filepath), 1); |
179 | - $queryKey = $namespace . "\\" . basename($filepath, ".php") . "#" . $modelMethod; |
|
179 | + $queryKey = $namespace."\\".basename($filepath, ".php")."#".$modelMethod; |
|
180 | 180 | |
181 | 181 | $query = null; |
182 | 182 | foreach ($this->queryAnnotations as $queryAnnotation) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | if ($query === null) { |
207 | - throw new DatabaseException("SQL statement can't getting from xml file: " . $modelMethod); |
|
207 | + throw new DatabaseException("SQL statement can't getting from xml file: ".$modelMethod); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $sql = $query["sql"]; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | if ($entityClassPath !== null) { |
215 | 215 | if (!class_exists($entityClassPath)) { |
216 | - throw new DatabaseException("Entity classpath is not found: " . $entityClassPath); |
|
216 | + throw new DatabaseException("Entity classpath is not found: ".$entityClassPath); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | switch ($method) { |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | $result = $this->manager->query($sql)->select()->toEntity($entityClassPath); |
226 | 226 | } |
227 | 227 | } else { |
228 | - $errorMessage = "Invalid SQL or bind parameters: " . $sql; |
|
228 | + $errorMessage = "Invalid SQL or bind parameters: ".$sql; |
|
229 | 229 | if (is_array($bind)) { |
230 | - $errorMessage .= ", " . strval($bind); |
|
230 | + $errorMessage .= ", ".strval($bind); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | throw new DatabaseException($errorMessage); |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | $result = $this->manager->query($sql)->{$method}(); |
252 | 252 | } |
253 | 253 | } else { |
254 | - $errorMessage = "Invalid SQL or bind parameters: " . $sql; |
|
254 | + $errorMessage = "Invalid SQL or bind parameters: ".$sql; |
|
255 | 255 | if (is_array($bind)) { |
256 | - $errorMessage .= ", " . strval($bind); |
|
256 | + $errorMessage .= ", ".strval($bind); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | 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 | { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | $isolationLevel === Connection::TRANSACTION_SERIALIZABLE) { |
115 | 115 | $this->connection->setTransactionIsolation($isolationLevel); |
116 | 116 | } else { |
117 | - throw new DatabaseException("Invalid transaction isolation level: " . $isolationLevel); |
|
117 | + throw new DatabaseException("Invalid transaction isolation level: ".$isolationLevel); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->logger->debug("Transaction start."); |
@@ -113,6 +113,7 @@ |
||
113 | 113 | /** |
114 | 114 | * SQLをセットしてステートメントを返却する |
115 | 115 | * @param string SQL |
116 | + * @param string $sql |
|
116 | 117 | * @return object ステートメント |
117 | 118 | */ |
118 | 119 | public function getStatement($sql) |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use WebStream\DI\Injector; |
5 | 5 | use WebStream\Module\Container; |
6 | -use Doctrine\DBAL\Connection; |
|
7 | 6 | |
8 | 7 | /** |
9 | 8 | * DatabaseDriver |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | /** |
66 | 66 | * SELECT |
67 | - * @return object 取得結果 |
|
67 | + * @return Result 取得結果 |
|
68 | 68 | */ |
69 | 69 | public function select() |
70 | 70 | { |
@@ -120,9 +120,9 @@ |
||
120 | 120 | try { |
121 | 121 | $stmt = $this->driver->getStatement($this->sql); |
122 | 122 | if ($stmt === false) { |
123 | - throw new DatabaseException("Can't create statement: ". $this->sql); |
|
123 | + throw new DatabaseException("Can't create statement: ".$this->sql); |
|
124 | 124 | } |
125 | - $this->logger->info("Executed SQL: " . $this->sql); |
|
125 | + $this->logger->info("Executed SQL: ".$this->sql); |
|
126 | 126 | foreach ($this->bind as $key => $value) { |
127 | 127 | $this->logger->info("Bind statement: $key => $value"); |
128 | 128 | if (preg_match("/^[0-9]+$/", $value) && is_int($value)) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Constructor |
35 | 35 | * @param CoreInterface インスタンス |
36 | - * @param Container DIContainer |
|
36 | + * @param Container Container |
|
37 | 37 | */ |
38 | 38 | public function __construct(Container $container) |
39 | 39 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param object インスタンス |
55 | 55 | * @param string メソッド |
56 | 56 | * @param string アノテーションクラスパス |
57 | - * @return Container コンテナ |
|
57 | + * @return null|AnnotationContainer コンテナ |
|
58 | 58 | */ |
59 | 59 | public function read($instance, $method = null, $classpath = null) |
60 | 60 | { |
@@ -59,7 +59,7 @@ |
||
59 | 59 | public function read($instance, $method = null, $classpath = null) |
60 | 60 | { |
61 | 61 | if (!$instance instanceof IAnnotatable) { |
62 | - $this->logger->warn("Annotation is not available this class: " . get_class($instance)); |
|
62 | + $this->logger->warn("Annotation is not available this class: ".get_class($instance)); |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 |