refactored FileLoader class to use new Assert class
This commit is contained in:
parent
4d8fae2fbe
commit
4e54616d1e
|
@ -10,19 +10,16 @@
|
||||||
|
|
||||||
namespace Bundle\WebServiceBundle\ServiceDefinition\Loader;
|
namespace Bundle\WebServiceBundle\ServiceDefinition\Loader;
|
||||||
|
|
||||||
|
use Bundle\WebServiceBundle\Util\Assert;
|
||||||
|
|
||||||
abstract class FileLoader implements LoaderInterface
|
abstract class FileLoader implements LoaderInterface
|
||||||
{
|
{
|
||||||
protected $file;
|
protected $file;
|
||||||
|
|
||||||
public function __construct($file)
|
public function __construct($file)
|
||||||
{
|
{
|
||||||
if (!file_exists($file)) {
|
Assert::thatArgument('file', file_exists($file), 'The service definition file %s does not exist');
|
||||||
throw new \InvalidArgumentException(sprintf('The service definition file %s does not exist', $file));
|
Assert::thatArgument('file', is_readable($file), 'The service definition file %s is not readable');
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_readable($file)) {
|
|
||||||
throw new \InvalidArgumentException(sprintf('The service definition file %s is not readable', $file));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue