@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | protected $fileExtensionAnalyzer; |
81 | 81 | |
82 | 82 | /** @var IDBConnection */ |
83 | - protected $connection; |
|
83 | + protected $connection; |
|
84 | 84 | |
85 | 85 | /** @var string */ |
86 | 86 | protected $userId; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | protected function getLastActivity($objectId) |
297 | 297 | { |
298 | 298 | $query = $this->connection->getQueryBuilder(); |
299 | - $query->select('*')->from('activity'); |
|
299 | + $query->select('*')->from('activity'); |
|
300 | 300 | $query->where($query->expr()->eq('affecteduser', $query->createNamedParameter($this->userId))) |
301 | 301 | ->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($objectId))); |
302 | 302 | $result = $query->execute(); |
@@ -94,22 +94,22 @@ |
||
94 | 94 | } |
95 | 95 | // starting byte sequence |
96 | 96 | if (array_key_exists('starting', $signature['signature'])) { |
97 | - foreach ($signature['signature']['starting']['bytes'] as $bytes) { |
|
98 | - if (preg_match($bytes, strtolower(bin2hex(substr($data, $signature['signature']['starting']['offset'], strlen($bytes) / 2))))) { |
|
99 | - $isFileCorrupted = false; |
|
100 | - } |
|
101 | - } |
|
97 | + foreach ($signature['signature']['starting']['bytes'] as $bytes) { |
|
98 | + if (preg_match($bytes, strtolower(bin2hex(substr($data, $signature['signature']['starting']['offset'], strlen($bytes) / 2))))) { |
|
99 | + $isFileCorrupted = false; |
|
100 | + } |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | // trailing byte sequence |
104 | 104 | if (array_key_exists('trailing', $signature['signature'])) { |
105 | 105 | $trailingIsNotMatching = true; |
106 | - foreach ($signature['signature']['trailing']['bytes'] as $bytes) { |
|
107 | - $trailingOffset = strlen($data) - $signature['signature']['trailing']['offset'] - strlen($bytes) / 2; |
|
108 | - if (preg_match($bytes, strtolower(bin2hex(substr($data, $trailingOffset, strlen($bytes) / 2))))) { |
|
109 | - $trailingIsNotMatching = false; |
|
110 | - } |
|
111 | - } |
|
112 | - $isFileCorrupted = $isFileCorrupted || $trailingIsNotMatching; |
|
106 | + foreach ($signature['signature']['trailing']['bytes'] as $bytes) { |
|
107 | + $trailingOffset = strlen($data) - $signature['signature']['trailing']['offset'] - strlen($bytes) / 2; |
|
108 | + if (preg_match($bytes, strtolower(bin2hex(substr($data, $trailingOffset, strlen($bytes) / 2))))) { |
|
109 | + $trailingIsNotMatching = false; |
|
110 | + } |
|
111 | + } |
|
112 | + $isFileCorrupted = $isFileCorrupted || $trailingIsNotMatching; |
|
113 | 113 | return new FileCorruptionResult($isFileCorrupted); |
114 | 114 | } |
115 | 115 | return new FileCorruptionResult($isFileCorrupted); |
@@ -144,23 +144,23 @@ |
||
144 | 144 | return 0.0; |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Calculates the median of an array. |
|
149 | - * |
|
150 | - * @param array $array |
|
151 | - * |
|
152 | - * @return float |
|
153 | - */ |
|
154 | - public function median($array) |
|
155 | - { |
|
156 | - if (is_array($array) && count($array) > 0) { |
|
157 | - $count = count($array); |
|
158 | - sort($array); |
|
159 | - $mid = floor(($count - 1) / 2); |
|
160 | - |
|
161 | - return ($array[$mid] + $array[$mid + 1 - $count % 2]) / 2; |
|
162 | - } |
|
163 | - |
|
164 | - return 0.0; |
|
165 | - } |
|
147 | + /** |
|
148 | + * Calculates the median of an array. |
|
149 | + * |
|
150 | + * @param array $array |
|
151 | + * |
|
152 | + * @return float |
|
153 | + */ |
|
154 | + public function median($array) |
|
155 | + { |
|
156 | + if (is_array($array) && count($array) > 0) { |
|
157 | + $count = count($array); |
|
158 | + sort($array); |
|
159 | + $mid = floor(($count - 1) / 2); |
|
160 | + |
|
161 | + return ($array[$mid] + $array[$mid + 1 - $count % 2]) / 2; |
|
162 | + } |
|
163 | + |
|
164 | + return 0.0; |
|
165 | + } |
|
166 | 166 | } |