Pop\File\File::getDirGroup PHP Method

getDirGroup() public method

Get the owner of the file. Works on POSIX file systems only
public getDirGroup ( ) : array
return array
    public function getDirGroup()
    {
        $group = array();
        if (DIRECTORY_SEPARATOR == '/') {
            if (file_exists($this->dir)) {
                $group = posix_getgrgid(filegroup($this->dir));
            }
        }
        return $group;
    }

Usage Example

Example #1
0
 public function testGetOwnerAndGroup()
 {
     $f = new File(__DIR__ . '/../tmp/access.txt');
     $this->assertTrue(array_key_exists('name', $f->getOwner()));
     $this->assertTrue(array_key_exists('name', $f->getDirOwner()));
     $this->assertTrue(array_key_exists('name', $f->getGroup()));
     $this->assertTrue(array_key_exists('name', $f->getDirGroup()));
     $this->assertTrue(array_key_exists('name', $f->getUser()));
 }