本文整理匯總了PHP中Assert\Assertion::readable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assertion::readable方法的具體用法?PHP Assertion::readable怎麽用?PHP Assertion::readable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::readable方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($directory)
{
Assertion::directory($directory);
Assertion::readable($directory);
$directory .= substr($directory, -1) === '/' ? '' : '/';
//add ending slash
$this->directory = $directory;
}
示例2: testReadable
public function testReadable()
{
Assertion::readable(__FILE__);
$this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_READABLE);
Assertion::readable(__DIR__ . '/does-not-exist');
}
示例3: fromFile
/**
* 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));
}
示例4: setCertificateFilePath
/**
* 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;
}
示例5: __construct
/**
* @param string $path
*/
public function __construct($path)
{
Assertion::readable($path);
$this->setResource(fopen($path, "rb"));
$this->validate();
}