public function testSet() { $file = new File(uniqid('.test_')); $this->assertFalse($file->exists()); $file->createNewFile(); $this->assertTrue($file->exists()); $this->assertTrue($file->isReadable()); $this->assertTrue($file->isWritable()); $this->assertFalse($file->isExecutable()); $file->setReadable(true); $file->setWritable(true); $file->setExecutable(true); // var_dump($file->isReadable()); // var_dump($file->isWritable()); // var_dump($file->isExecutable()); }
/** * Return the simple boolean attributes for the file or directory denoted * by the given pathname, or zero if it does not exist or some * other I/O error occurs. * * @param File $f * @return int */ public function getBooleanAttributes(File $f) { if (!$f->exists()) { return 0; } $mode = substr(sprintf('%o', $f->getPerms()), -4); $mode = intval($mode, 8); return $mode; }