Content   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fread() 0 9 2
1
<?php
2
/**
3
 * ownCloud - files_antivirus
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Viktar Dubiniuk <[email protected]>
9
 *
10
 * @copyright Viktar Dubiniuk 2015-2018
11
 * @license AGPL-3.0
12
 */
13
14
namespace OCA\Files_Antivirus;
15
16
class Content implements IScannable {
17
	protected $content;
18
	
19
	protected $currentPosition = 0;
20
	
21
	protected $chunkSize;
22
	
23 3
	public function __construct($content, $chunkSize) {
24 3
		$this->content = $content;
25 3
		$this->chunkSize = $chunkSize;
26 3
	}
27
	
28 3
	public function fread() {
29 3
		if ($this->currentPosition >= \strlen($this->content)) {
30 3
			return false;
31
		}
32 3
		$chunk = \substr($this->content, $this->currentPosition, $this->chunkSize);
33 3
		$this->currentPosition = $this->currentPosition + $this->chunkSize;
34
		
35 3
		return $chunk;
36
	}
37
}
38