Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
65 | 14 | public function getResourceFromId($nodeId) { |
|
66 | try { |
||
67 | 14 | $node = $this->environment->getResourceFromId($nodeId); |
|
68 | |||
69 | // Making extra sure that we can actually do something with the file |
||
70 | 11 | if (!$node->getMimetype() || !$node->isReadable()) { |
|
71 | 1 | throw new NotFoundServiceException("Can't access the file"); |
|
72 | } |
||
73 | |||
74 | 10 | return $node; |
|
75 | 4 | } catch (\Exception $exception) { |
|
76 | 4 | throw new NotFoundServiceException($exception->getMessage()); |
|
77 | } |
||
78 | } |
||
79 | |||
81 |