public function getIdFromUri($binaryFileUri) { if (isset($this->urlDecorator)) { return $this->urlDecorator->undecorate($binaryFileUri); } else { return ltrim($binaryFileUri, '/'); } }
public function testRedecorateFromTarget() { $this->targetDecoratorMock->expects($this->once())->method('undecorate')->with('/var/test/storage/images/file.png')->will($this->returnValue('images/file.png')); $this->sourceDecoratorMock->expects($this->once())->method('decorate')->with('images/file.png')->will($this->returnValue('http://static.example.com/images/file.png')); self::assertEquals('http://static.example.com/images/file.png', $this->redecorator->redecorateFromTarget('/var/test/storage/images/file.png')); }
/** * Removes the internal prefix string from $prefixedId * * @param string $prefixedId * * @return string the id without the prefix * @throws InvalidBinaryFileIdException if the prefix isn't found in $prefixedId */ protected function removePrefix($prefixedId) { return isset($this->urlDecorator) ? $this->urlDecorator->undecorate($prefixedId) : $prefixedId; }