@@ -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 | } |
@@ -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 | { |
@@ -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: |
@@ -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\Module\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 |
@@ -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 |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Viewを起動する |
123 | - * @return CoreView Viewオブジェクト |
|
123 | + * @return CoreExecuteDelegator Viewオブジェクト |
|
124 | 124 | */ |
125 | 125 | public function runView() |
126 | 126 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use WebStream\Core\CoreHelper; |
8 | 8 | use WebStream\Module\Container; |
9 | 9 | use WebStream\Module\Utility\FileUtils; |
10 | -use WebStream\Exception\Extend\RouterException; |
|
11 | 10 | use WebStream\Exception\Extend\ResourceNotFoundException; |
12 | 11 | |
13 | 12 | /** |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | $this->response->start(); |
75 | 75 | |
76 | 76 | if ($this->router->controller !== null && $this->router->action !== null) { |
77 | - $iterator = $this->getFileSearchIterator($this->container->applicationInfo->applicationRoot . "/app/controllers"); |
|
77 | + $iterator = $this->getFileSearchIterator($this->container->applicationInfo->applicationRoot."/app/controllers"); |
|
78 | 78 | foreach ($iterator as $filepath => $fileObject) { |
79 | - if (strpos($filepath, $this->router->controller . ".php") !== false) { |
|
79 | + if (strpos($filepath, $this->router->controller.".php") !== false) { |
|
80 | 80 | include_once $filepath; |
81 | 81 | } |
82 | 82 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $controller->__callStaticFile($this->router->staticFile); |
88 | 88 | } else { |
89 | 89 | $this->response->clean(); |
90 | - $errorMsg = "Failed to resolve the routing: " . $this->request->requestUri; |
|
90 | + $errorMsg = "Failed to resolve the routing: ".$this->request->requestUri; |
|
91 | 91 | throw new ResourceNotFoundException($errorMsg); |
92 | 92 | } |
93 | 93 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | } elseif ($this->router->staticFile !== null) { |
86 | 86 | $controller = new CoreController(); |
87 | 87 | $controller->inject('coreDelegator', $this->container->coreDelegator) |
88 | - ->inject('logger', $this->container->logger); |
|
88 | + ->inject('logger', $this->container->logger); |
|
89 | 89 | |
90 | 90 | $controller->__callStaticFile($this->router->staticFile); |
91 | 91 | } else { |