/** * Setter */ public function __set($property, $value) { if (!in_array($property, explode(',', File::READONLY))) { if ($property == 'password') { $this->salt = hash('sha512', uniqid()); $this->password = Utils::createPasswordHash($value, $this->salt); return; } else { if ($property == 'permission') { $this->permission = FilePermissions::parse($value); return; } else { if ($property == 'folder' && $value === NULL) { $this->folderid = NULL; return; } else { if ($property == 'folder' && $value instanceof Folder) { $this->folderid = $value->id; return; } } } } $this->{$property} = $value; if ($property == 'filename') { $this->ext = File::getExtension($this->filename); } } else { throw new InvalidArgumentException('Property ' . $property . ' is readonly'); } }