|
@@ 11-18 (lines=8) @@
|
| 8 |
|
|
| 9 |
|
class SimpleStreamProvider implements IStreamProvider2 |
| 10 |
|
{ |
| 11 |
|
public function getReadStream2($entity, ResourceStreamInfo $resourceStreamInfo = null, $eTag, $checkETagForEquality, IOperationContext $operationContext) |
| 12 |
|
{ |
| 13 |
|
if (null == $resourceStreamInfo) { |
| 14 |
|
return "stream for " . get_class($entity); |
| 15 |
|
} |
| 16 |
|
$name = $resourceStreamInfo->getName(); |
| 17 |
|
return $entity->$name; |
| 18 |
|
} |
| 19 |
|
|
| 20 |
|
public function getDefaultStreamEditMediaUri($entity, ResourceType $resourceType, ResourceStreamInfo $resourceStreamInfo = null, IOperationContext $operationContext, $relativeUri = null) |
| 21 |
|
{ |
|
@@ 36-47 (lines=12) @@
|
| 33 |
|
return 'application/octet-stream'; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
public function getStreamETag2( |
| 37 |
|
$entity, |
| 38 |
|
ResourceStreamInfo $resourceStreamInfo = null, |
| 39 |
|
IOperationContext $operationContext |
| 40 |
|
) { |
| 41 |
|
if (null == $resourceStreamInfo) { |
| 42 |
|
return spl_object_hash($entity); |
| 43 |
|
} |
| 44 |
|
$name = $resourceStreamInfo->getName(); |
| 45 |
|
|
| 46 |
|
return sha1($entity->$name); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
public function getReadStreamUri2( |
| 50 |
|
$entity, |