public function __construct($directory) { Assertion::directory($directory); Assertion::readable($directory); $directory .= substr($directory, -1) === '/' ? '' : '/'; //add ending slash $this->directory = $directory; }
public function testReadable() { Assertion::readable(__FILE__); $this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_READABLE); Assertion::readable(__DIR__ . '/does-not-exist'); }
/** * 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; }
/** * @param string $path */ public function __construct($path) { Assertion::readable($path); $this->setResource(fopen($path, "rb")); $this->validate(); }