for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author stev leibelt <[email protected]>
* @since 2014-05-26
*/
namespace Net\Bazzline\Component\Locator\FileExistsStrategy;
* Class AbstractStrategy
* @package Net\Bazzline\Component\Locator\FileExistsStrategy
abstract class AbstractStrategy implements FileExistsStrategyInterface
{
/** @var null|string */
private $fileName;
private $filePath;
* @param string $name
* @return $this
* @throws InvalidArgumentException
public function setFileName($name)
$name = (string) $name;
if ($name === '') {
throw new InvalidArgumentException(
'invalid filename given'
);
}
$this->fileName = $name;
return $this;
* @param string $path
public function setFilePath($path)
if (!is_dir($path)) {
'provided path "' . $path . '" has to be a directory'
if (!is_writable($path)) {
'provided path "' . $path . '" has to be writable'
$this->filePath = $path;
* @return null|string
* @throws RuntimeException
protected function getFileName()
if (is_null($this->fileName)) {
throw new RuntimeException(
'file name is mandatory'
return $this->fileName;
protected function getFilePath()
if (is_null($this->filePath)) {
'file path is mandatory'
return $this->filePath;
protected function resetFileName()
$this->fileName = null;
protected function resetFilePath()
$this->filePath = null;