readable() public static method

Assert that the value is something readable
public static readable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
return boolean
 public function __construct($directory)
 {
     Assertion::directory($directory);
     Assertion::readable($directory);
     $directory .= substr($directory, -1) === '/' ? '' : '/';
     //add ending slash
     $this->directory = $directory;
 }
Exemplo n.º 2
0
 public function testReadable()
 {
     Assertion::readable(__FILE__);
     $this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_READABLE);
     Assertion::readable(__DIR__ . '/does-not-exist');
 }
Exemplo n.º 3
0
 /**
  * Creates a new Doc with the DocStream set to the content of
  * the specified file path.
  *
  * @param $DocType
  * @param $DocMimeType
  * @param $FilePath
  * @return Doc
  *
  * @throws \InvalidArgumentException If the file does not exist or is not readable.
  */
 public static function fromFile($DocType, $DocMimeType, $FilePath)
 {
     Assertion::file($FilePath, "{$FilePath} does not exist.");
     Assertion::readable($FilePath, "{$FilePath} is not readable.");
     return new self($DocType, $DocMimeType, file_get_contents($FilePath));
 }
 /**
  * Sets a certificate file path and optional passphrase to use.
  *
  * @param string $certificateFilePath Path to a certificate file.
  * @return Config
  *
  * @throws \InvalidArgumentException If certificate path is invalid.
  */
 public function setCertificateFilePath($certificateFilePath, $passphrase = null)
 {
     Assertion::file($certificateFilePath);
     Assertion::readable($certificateFilePath);
     $this->certificateFilePath = $certificateFilePath;
     $this->soapClientOptions['local_cert'] = $certificateFilePath;
     if (!empty($passphrase)) {
         $this->soapClientOptions['passphrase'] = $passphrase;
     }
     return $this;
 }
Exemplo n.º 5
0
 /**
  * @param string $path
  */
 public function __construct($path)
 {
     Assertion::readable($path);
     $this->setResource(fopen($path, "rb"));
     $this->validate();
 }