Completed
Push — master ( d03abb...fe3c08 )
by Alex
01:26
created

SimpleStreamProvider   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getReadStream() 0 8 1
A getStreamContentType() 0 4 1
A getStreamETag() 0 4 1
A getReadStreamUri() 0 5 1
A getReadStream2() 0 6 1
A getStreamContentType2() 0 4 1
A getStreamETag2() 0 8 1
A getReadStreamUri2() 0 8 1
1
<?php
2
3
namespace POData\Providers\Stream;
4
5
use POData\Providers\Metadata\ResourceStreamInfo;
6
use POData\OperationContext\IOperationContext;
7
use POData\Common\ODataException;
8
9
class SimpleStreamProvider implements IStreamProvider2
10
{
11
    public function getReadStream(
12
        $entity,
13
        $eTag,
14
        $checkETagForEquality,
15
        IOperationContext $operationContext
16
    ) {
17
         return null; // TODO: find default stream and return.
18
      }
19
    public function getStreamContentType($entity,IOperationContext $operationContext)
20
    {
21
        return 'application/octet-stream';
22
    }
23
     public function getStreamETag($entity, IOperationContext $operationContext)
24
    {
25
        return null; // TODO: find default stream and return.
26
    }
27
28
    public function getReadStreamUri($entity, IOperationContext $operationContext)
29
    {
30
        //let library creates default media url.
31
        return null;
32
    }
33
    public function getReadStream2($entity, ResourceStreamInfo $resourceStreamInfo, $eTag, $checkETagForEquality, IOperationContext $operationContext)
34
    {
35
36
        $name = $resourceStreamInfo->getName();
37
        return $entity->$name;
38
    }
39
    public function getStreamContentType2($entity, ResourceStreamInfo $resourceStreamInfo, IOperationContext $operationContext)
40
    {
41
        return 'application/octet-stream';
42
    }
43
    public function getStreamETag2(
44
        $entity,
45
        ResourceStreamInfo $resourceStreamInfo,
46
        IOperationContext $operationContext
47
    ) {
48
        $name = $resourceStreamInfo->getName();
49
        return sha1($entity->$name);
50
    }
51
    public function getReadStreamUri2(
52
        $entity,
53
        ResourceStreamInfo $resourceStreamInfo,
54
        IOperationContext $operationContext
55
    ) {
56
        //let library creates default media url.
57
        return null;
58
    }
59
}
60