本文整理汇总了PHP中SplFileInfo::isExecutable方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::isExecutable方法的具体用法?PHP SplFileInfo::isExecutable怎么用?PHP SplFileInfo::isExecutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplFileInfo
的用法示例。
在下文中一共展示了SplFileInfo::isExecutable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDecoratedMethods
public function testDecoratedMethods()
{
$decorated = $this->getMockBuilder('hanneskod\\classtools\\Tests\\MockSplFileInfo')->setConstructorArgs([''])->getMock();
$decorated->expects($this->once())->method('getRelativePath');
$decorated->expects($this->once())->method('getRelativePathname');
$decorated->expects($this->once())->method('getContents');
$decorated->expects($this->once())->method('getATime');
$decorated->expects($this->once())->method('getBasename');
$decorated->expects($this->once())->method('getCTime');
$decorated->expects($this->once())->method('getExtension');
$decorated->expects($this->once())->method('getFileInfo');
$decorated->expects($this->once())->method('getFilename');
$decorated->expects($this->once())->method('getGroup');
$decorated->expects($this->once())->method('getInode');
$decorated->expects($this->once())->method('getLinkTarget');
$decorated->expects($this->once())->method('getMTime');
$decorated->expects($this->once())->method('getOwner');
$decorated->expects($this->once())->method('getPath');
$decorated->expects($this->once())->method('getPathInfo');
$decorated->expects($this->once())->method('getPathname');
$decorated->expects($this->once())->method('getPerms');
$decorated->expects($this->once())->method('getRealPath');
$decorated->expects($this->once())->method('getSize');
$decorated->expects($this->once())->method('getType');
$decorated->expects($this->once())->method('isDir');
$decorated->expects($this->once())->method('isExecutable');
$decorated->expects($this->once())->method('isFile');
$decorated->expects($this->once())->method('isLink');
$decorated->expects($this->once())->method('isReadable');
$decorated->expects($this->once())->method('isWritable');
$decorated->expects($this->once())->method('openFile');
$decorated->expects($this->once())->method('setFileClass');
$decorated->expects($this->once())->method('setInfoClass');
$decorated->expects($this->once())->method('__toString')->will($this->returnValue(''));
$fileInfo = new SplFileInfo($decorated);
$fileInfo->getRelativePath();
$fileInfo->getRelativePathname();
$fileInfo->getContents();
$fileInfo->getATime();
$fileInfo->getBasename();
$fileInfo->getCTime();
$fileInfo->getExtension();
$fileInfo->getFileInfo();
$fileInfo->getFilename();
$fileInfo->getGroup();
$fileInfo->getInode();
$fileInfo->getLinkTarget();
$fileInfo->getMTime();
$fileInfo->getOwner();
$fileInfo->getPath();
$fileInfo->getPathInfo();
$fileInfo->getPathname();
$fileInfo->getPerms();
$fileInfo->getRealPath();
$fileInfo->getSize();
$fileInfo->getType();
$fileInfo->isDir();
$fileInfo->isExecutable();
$fileInfo->isFile();
$fileInfo->isLink();
$fileInfo->isReadable();
$fileInfo->isWritable();
$fileInfo->openFile();
$fileInfo->setFileClass();
$fileInfo->setInfoClass();
(string) $fileInfo;
}
示例2: isExecutable
/**
*/
public function isExecutable()
{
if (null === $this->x) {
$this->x = parent::isExecutable();
}
return $this->x;
}
示例3: main
/**
* executes the synfony consile application
*/
public function main()
{
$this->prepareCommand();
$this->log("executing {$this->commandLine}");
$composerFile = new SplFileInfo($this->getComposer());
if (false === $composerFile->isExecutable() || false === $composerFile->isFile()) {
throw new BuildException(sprintf('Composer binary not found, path is "%s"', $composerFile));
}
$return = 0;
passthru($this->commandLine, $return);
if ($return > 0) {
throw new BuildException("Composer execution failed");
}
}
示例4: _checkPerms
protected function _checkPerms($path, $value)
{
if (!$path instanceof SplFileInfo) {
try {
$path = new SplFileInfo($path);
} catch (Exception $e) {
return false;
}
}
// Get perms
$perms = 0;
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' || $path->isExecutable()) {
$perms |= 0x1;
}
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$value |= 0x1;
}
if ($path->isWritable()) {
$perms |= 0x2;
}
if ($path->isReadable()) {
$perms |= 0x4;
}
// Apply file umask to requested permission
if ($path->isFile()) {
$value &= ~$this->_fileUmask;
}
// Check
if (($perms & $value) != $value) {
return false;
}
// Recurse if necessary, and is directory
if ($this->_recursive && $path->isDir()) {
try {
$it = new DirectoryIterator($path->getPathname());
} catch (Exception $e) {
// AFAIK this is caused by not having enough permissions
return false;
}
foreach ($it as $fileinfo) {
$flname = $fileinfo->getFilename();
if ($fileinfo->isDot() || $flname[0] == '.' || $flname == 'CVS') {
continue;
}
if ($this->_ignoreFiles && $fileinfo->isFile()) {
continue;
}
if (!$this->_checkPerms($fileinfo, $value)) {
return false;
}
}
}
return true;
}
示例5: SplFileInfo
<?php
$info = new SplFileInfo('SplFileInfo.php');
printf("Extension: %s\n", $info->getExtension());
printf("Filename: %s\n", $info->getFilename());
printf("Path: %s\n", $info->getPathname());
printf("RealPath: %s\n", $info->getRealPath());
printf("Type: %s\n", $info->getType());
printf("Size: %s\n", $info->getSize());
printf("Dir: %b, Exec: %b, File: %b, Link: %b, R: %b, W: %b\n", $info->isDir(), $info->isExecutable(), $info->isFile(), $info->isLink(), $info->isReadable(), $info->isWritable());
$file = $info->openFile('r');
foreach ($file as $line) {
printf("%s", $line);
}
示例6: testIsExecutable
/**
* @depends testExist
* @return void
*/
public function testIsExecutable()
{
$filePath = __DIR__ . '/example.txt';
$fileObject = new File($filePath);
$result = $fileObject->isExecutable();
$fileObject = new \SplFileInfo($filePath);
$this->assertEquals($result, $fileObject->isExecutable());
}
示例7: getFileDetailsRawStatistic
protected function getFileDetailsRawStatistic(\SplFileInfo $info, $fileGiven)
{
return ['File is Dir' => $info->isDir(), 'File is Executable' => $info->isExecutable(), 'File is File' => $info->isFile(), 'File is Link' => $info->isLink(), 'File is Readable' => $info->isReadable(), 'File is Writable' => $info->isWritable(), 'File Permissions' => $this->explainPerms($info->getPerms()), 'Size' => $info->getSize(), 'Sha1' => sha1_file($fileGiven), 'Timestamp Accessed' => $this->getFileTimes($info->getATime()), 'Timestamp Changed' => $this->getFileTimes($info->getCTime()), 'Timestamp Modified' => $this->getFileTimes($info->getMTime())];
}