Completed
Push — master ( 86ba99...4fe26b )
by
unknown
03:43
created

Content   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
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 23
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
 * Copyright (c) 2015 Viktar Dubiniuk <[email protected]>
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later.
6
 * See the COPYING-README file.
7
 */
8
9
namespace OCA\Files_Antivirus;
10
11
class Content implements IScannable{
12
	
13
	protected $content;
14
	
15
	protected $currentPosition = 0;
16
	
17
	protected $chunkSize;
18
	
19 3
	public function __construct($content, $chunkSize){
20 3
		$this->content = $content;
21 3
		$this->chunkSize = $chunkSize;
22 3
	}
23
	
24 3
	public function fread(){
25 3
		if ($this->currentPosition >=  strlen($this->content)) {
26 3
			return false;
27
		}
28 3
		$chunk = substr($this->content, $this->currentPosition, $this->chunkSize);
29 3
		$this->currentPosition = $this->currentPosition + $this->chunkSize;
30
		
31 3
		return $chunk;
32
	}
33
}
34