Pop\File\File::getOwner PHP Method

getOwner() public method

Get the owner of the file. Works on POSIX file systems only
public getOwner ( ) : array
return array
    public function getOwner()
    {
        $owner = array();
        if (DIRECTORY_SEPARATOR == '/') {
            $owner = file_exists($this->fullpath) ? posix_getpwuid(fileowner($this->fullpath)) : $this->getUser();
        }
        return $owner;
    }

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()));
 }