From 4e54616d1e9afaaae60ae85e6619f7f68e7f4ff7 Mon Sep 17 00:00:00 2001 From: Christian Kerl Date: Fri, 7 Jan 2011 23:02:04 +0100 Subject: [PATCH] refactored FileLoader class to use new Assert class --- ServiceDefinition/Loader/FileLoader.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ServiceDefinition/Loader/FileLoader.php b/ServiceDefinition/Loader/FileLoader.php index 9a54e2c..a7e86bf 100644 --- a/ServiceDefinition/Loader/FileLoader.php +++ b/ServiceDefinition/Loader/FileLoader.php @@ -10,19 +10,16 @@ namespace Bundle\WebServiceBundle\ServiceDefinition\Loader; +use Bundle\WebServiceBundle\Util\Assert; + abstract class FileLoader implements LoaderInterface { protected $file; public function __construct($file) { - if (!file_exists($file)) { - throw new \InvalidArgumentException(sprintf('The service definition file %s does not exist', $file)); - } - - if (!is_readable($file)) { - throw new \InvalidArgumentException(sprintf('The service definition file %s is not readable', $file)); - } + Assert::thatArgument('file', file_exists($file), 'The service definition file %s does not exist'); + Assert::thatArgument('file', is_readable($file), 'The service definition file %s is not readable'); $this->file = $file; }