当前位置: 首页>>代码示例>>PHP>>正文


PHP SplFileInfo::isExecutable方法代码示例

本文整理汇总了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;
 }
开发者ID:hanneskod,项目名称:classtools,代码行数:67,代码来源:SplFileInfoTest.php

示例2: isExecutable

 /**
  */
 public function isExecutable()
 {
     if (null === $this->x) {
         $this->x = parent::isExecutable();
     }
     return $this->x;
 }
开发者ID:shads196770,项目名称:cbox-theme,代码行数:9,代码来源:file.php

示例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");
     }
 }
开发者ID:rozwell,项目名称:phing,代码行数:17,代码来源:ComposerTask.php

示例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;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:54,代码来源:FilePermission.php

示例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);
}
开发者ID:Eldahar,项目名称:PHP_Library,代码行数:14,代码来源:SplFileInfo.php

示例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());
 }
开发者ID:naucon,项目名称:file,代码行数:12,代码来源:FileTest.php

示例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())];
 }
开发者ID:danielgp,项目名称:common-lib,代码行数:4,代码来源:CommonBasic.php


注:本文中的SplFileInfo::isExecutable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。