@@ -44,6 +44,9 @@ |
||
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | + /** |
|
48 | + * @return string |
|
49 | + */ |
|
47 | 50 | public function getTemporaryName() { |
48 | 51 | |
49 | 52 | return $this->tname; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!empty($this->path) && file_exists($this->path)) { |
110 | 110 | |
111 | - $local_name = "$this->path/" . ($as_slug ? $this->getSlug() : $this->getFileName()); |
|
111 | + $local_name = "$this->path/".($as_slug ? $this->getSlug() : $this->getFileName()); |
|
112 | 112 | |
113 | - if ( file_exists($local_name) ) { |
|
113 | + if (file_exists($local_name)) { |
|
114 | 114 | |
115 | 115 | $files = glob("$local_name*"); |
116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | - if ( move_uploaded_file($this->getTemporaryName(), $local_name) ) { |
|
123 | + if (move_uploaded_file($this->getTemporaryName(), $local_name)) { |
|
124 | 124 | |
125 | 125 | // return file_exists($local_name); |
126 | 126 | return true; |
@@ -84,7 +84,9 @@ |
||
84 | 84 | |
85 | 85 | $file = $this->getTemporaryName(); |
86 | 86 | |
87 | - if (file_exists($file)) return file_get_contents($file); |
|
87 | + if (file_exists($file)) { |
|
88 | + return file_get_contents($file); |
|
89 | + } |
|
88 | 90 | |
89 | 91 | throw new Exception("File does not exists"); |
90 | 92 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | protected $dispatcher; |
31 | 31 | |
32 | - public function __construct( Dispatcher $dispatcher ) { |
|
32 | + public function __construct(Dispatcher $dispatcher) { |
|
33 | 33 | |
34 | 34 | parent::__construct('dispatcher'); |
35 | 35 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | public function get($header = null) { |
30 | 30 | |
31 | - if ( is_null($header) ) return $this->headers; |
|
31 | + if (is_null($header)) return $this->headers; |
|
32 | 32 | |
33 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
33 | + else if (array_key_exists($header, $this->headers)) return $this->headers[$header]; |
|
34 | 34 | |
35 | 35 | else return null; |
36 | 36 | |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | public function getAsString($header = null) { |
40 | 40 | |
41 | - if ( is_null($header) ) { |
|
41 | + if (is_null($header)) { |
|
42 | 42 | |
43 | - return array_map( [$this, 'headerToString'], |
|
43 | + return array_map([$this, 'headerToString'], |
|
44 | 44 | array_keys($this->headers), |
45 | 45 | array_values($this->headers) |
46 | 46 | ); |
47 | 47 | |
48 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
48 | + } else if (array_key_exists($header, $this->headers)) { |
|
49 | 49 | |
50 | 50 | return self::headerToString($header, $this->headers[$header]); |
51 | 51 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | - public function set($header, $value=null) { |
|
56 | + public function set($header, $value = null) { |
|
57 | 57 | |
58 | - if ( is_null($value) ) { |
|
58 | + if (is_null($value)) { |
|
59 | 59 | |
60 | 60 | $header = explode(":", $header); |
61 | 61 | |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | |
74 | 74 | public function delete($header = null) { |
75 | 75 | |
76 | - if ( is_null($header) ) { |
|
76 | + if (is_null($header)) { |
|
77 | 77 | |
78 | 78 | $this->headers = array(); |
79 | 79 | |
80 | 80 | return true; |
81 | 81 | |
82 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
82 | + } else if (array_key_exists($header, $this->headers)) { |
|
83 | 83 | |
84 | 84 | unset($this->headers[$header]); |
85 | 85 |
@@ -29,11 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | public function get($header = null) { |
31 | 31 | |
32 | - if ( is_null($header) ) return $this->headers; |
|
33 | - |
|
34 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
35 | - |
|
36 | - else return null; |
|
32 | + if ( is_null($header) ) { |
|
33 | + return $this->headers; |
|
34 | + } else if ( array_key_exists($header, $this->headers) ) { |
|
35 | + return $this->headers[$header]; |
|
36 | + } else { |
|
37 | + return null; |
|
38 | + } |
|
37 | 39 | |
38 | 40 | } |
39 | 41 | |
@@ -50,7 +52,9 @@ discard block |
||
50 | 52 | |
51 | 53 | return (string)($header.':'.$this->headers[$header]); |
52 | 54 | |
53 | - } else return null; |
|
55 | + } else { |
|
56 | + return null; |
|
57 | + } |
|
54 | 58 | |
55 | 59 | } |
56 | 60 |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | Cache $cache |
44 | 44 | ) { |
45 | 45 | |
46 | - $name = (string) $request->method . (string) $request->uri; |
|
46 | + $name = (string)$request->method.(string)$request->uri; |
|
47 | 47 | |
48 | 48 | $cache_object = $cache->setNamespace('dispatcherservice')->get($name); |
49 | 49 | |
50 | - if ( is_null($cache_object) ) return false; |
|
50 | + if (is_null($cache_object)) return false; |
|
51 | 51 | |
52 | 52 | $response->import($cache); |
53 | 53 | |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | |
67 | 67 | $ttl = $route->getParameter('ttl'); |
68 | 68 | |
69 | - $name = (string) $request->method . (string) $request->uri; |
|
69 | + $name = (string)$request->method.(string)$request->uri; |
|
70 | 70 | |
71 | 71 | $method = $request->method->get(); |
72 | 72 | |
73 | 73 | $status = $response->status->get(); |
74 | 74 | |
75 | 75 | if ( |
76 | - ( $cache == 'SERVER' || $cache == 'BOTH' ) && |
|
76 | + ($cache == 'SERVER' || $cache == 'BOTH') && |
|
77 | 77 | in_array($method, self::$cachable_methods) && |
78 | 78 | in_array($status, self::$cachable_statuses) |
79 | - ){ |
|
79 | + ) { |
|
80 | 80 | |
81 | 81 | $cache->setNamespace('dispatcherservice')->set($name, $response->export(), $ttl); |
82 | 82 |
@@ -47,7 +47,9 @@ |
||
47 | 47 | |
48 | 48 | $cache_object = $this->cache->setNamespace('dispatcherservice')->get($name); |
49 | 49 | |
50 | - if ( is_null($cache_object) ) return false; |
|
50 | + if ( is_null($cache_object) ) { |
|
51 | + return false; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | $response->import($cache); |
53 | 55 |