Add the file and set the errors.

@param $folder
@param $permission
@param $isSet
500878
private function addFileAndSetErrors($folder, $permission, $isSet)
    {
        $this->addFile($folder, $permission, $isSet);

        $this->results['errors'] = true;
    }
579498
private function createRules(Permission $permission): void
	{
		/* @var $rule Acl */
		foreach ($this->orm->acl->findAll() as $rule) {
			if ($rule->allowed) {
				$permission->allow($rule->role->name, $rule->resource->resource, $rule->privilege);
			} else {
				$permission->deny($rule->role->name, $rule->resource->resource, $rule->privilege);
			}
		}
	}
763036
protected function add(Permission $permission, $override = true)
    {
        if ($override || ! $this->permissions->containsKey($permission->getName()))
        {
            $this->permissions->set($permission->getName(), $permission);
        }
    }
770237
public function chmod($permission,$file)
    {
        if (! ftp_chmod($this->session, $permission, $file)) {
            throw new \RuntimeException('Chmod can not be changed');
        }
        return true;
    }
766854
protected function allowCreate($dir, $name, $isDir = null) {
		$path = $this->joinPathCE($dir, $name);
		$perm = null;
		
		if ($this->access) {
			$perm = call_user_func($this->access, 'write', $path, $this->options['accessControlData'], $this, $isDir);			
			if ($perm !== null) {
				return !!$perm;
			}
		}
		
		$testPath = $this->separator.$this->relpathCE($path);
		
		for ($i = 0, $c = count($this->attributes); $i < $c; $i++) {
			$attrs = $this->attributes[$i];
			
			if (isset($attrs['write']) && isset($attrs['pattern']) && preg_match($attrs['pattern'], $testPath)) {
				$perm = $attrs['write'];
			} 
		}
		
		return $perm === null ? true : $perm;
	}
877085
public function addPermission($name, $permission = true)
    {
        $slugs = $this->permissions->keyBy('name');
        list($slug, $name) = $this->extractAlias($name);

        if ( $slugs->has($name) && is_null($slug) && ! is_array($permission) ) {
            return true;
        }

        if ( ! $slugs->has($name) && is_null($slug) ) {
            return $this->addPermissionCrud($name);
        }

        $slug = is_array($permission)
            ? $permission : [$slug => (bool) $permission];

        // if alias doesn't exist, create permission
        if ( ! $slugs->has($name) ) {
            $new = $this->permissions()->create(compact('name', 'slug'));
            $this->permissions->push($new);

            return $new;
        }

        // update slug
        return $slugs[$name]->update(compact('slug'));
    }
382243
protected function createDirectory(string $path, int $permissions = 0755)
    {
        if (!is_dir($path)) {
            $this->info("Creating directory '{$path}'", OutputInterface::VERBOSITY_VERBOSE);

            mkdir($path, $permissions, true);
        }
    }
900061
protected function storePermission(Permission $permission)
    {
        // Don't re-store the permission if it already exists.
        if (! $this->hasPermission($permission)) {
            $this->getDriver()->storeCallerPermission($this->caller, $permission);
        }
    }
394441
protected function storePermission(Permission $permission)
    {
        // Don't re-store the permission if it already exists.
        if (! $this->hasPermission($permission)) {
            $this->getDriver()->storeRolePermission($this->role, $permission);
        }
    }
690642
public function setXML($xml, $isFile = false)
    {
        $this->_xml = ($isFile ? file_get_contents($xml) : $xml);
    }
840277
public function openFolder($folder_path, $attempts = 3) {
        $this->checkConnection();

        if(property_exists($folder_path, 'path')) {
            $folder_path = $folder_path->path;
        }

        if ($this->active_folder !== $folder_path) {
            $this->active_folder = $folder_path;

            imap_reopen($this->getConnection(), $folder_path, $this->getOptions(), $attempts);
        }
    }
617230
private static function addBlockErrors(
        iterable $errorsInfo,
        ContextStorageInterface $context,
        ErrorAggregatorInterface $errors
    ): void {
        foreach ($errorsInfo as $errorInfo) {
            $index           = $errorInfo[BlockReplies::ERROR_INFO_BLOCK_INDEX];
            $value           = $errorInfo[BlockReplies::ERROR_INFO_VALUE];
            $errorCode       = $errorInfo[BlockReplies::ERROR_INFO_CODE];
            $messageTemplate = $errorInfo[BlockReplies::ERROR_INFO_MESSAGE_TEMPLATE];
            $messageParams   = $errorInfo[BlockReplies::ERROR_INFO_MESSAGE_PARAMETERS];

            $name = $context->setCurrentBlockId($index)->getProperties()->getProperty(BaseRule::PROPERTY_NAME);

            $errors->add(new Error($name, $value, $errorCode, $messageTemplate, $messageParams));
        }
    }
684455
public static function put(string $path, string $contents, bool $lock = false): int
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }
442247
public function setUploadFolder($folder)
    {
        $this->uploadPath  = $this->basePath . $folder . '/' . $this->getUniqueFolderName() . '/';
        $this->destination = $this->publicPath ? public_path($this->uploadPath) : $this->uploadPath;
    }
457593
private function setPublicForFolder(Folder $folder, $public)
	{
		$descendants = $folder->getDescendants();
		foreach ($descendants as $node) {
			if ($node instanceof File) {
				$this->setPublicForFile($node, $public);
			}

			if ($node instanceof Folder) {
				$node->setPublic($public);
			}
		}
		$folder->setPublic($public);
	}
814103
public function mkdir($path, $permissions = 0755)
    {
        $writeBinn = new BinnList;

        $writeBinn->addUint8(self::FSERV_MKDIR);
        $writeBinn->addStr($path);
        $writeBinn->addStr($permissions);

        $read = $this->writeAndReadSocket($writeBinn->serialize());

        $readBinn = new BinnList;
        $readBinn->binnOpen($read);
        $results = $readBinn->unserialize();

        if ($results[0] != self::FSERV_STATUS_OK) {
            throw new RuntimeException('Couldn\'t make directory: ' . isset($results[1]) ? $results[1] : 'Unknown');
        }

        return true;
    }
1253575
public function setFolder($folder)
    {
        if (substr($folder, strrpos($folder, '/')) !== strlen($folder)) {
            $folder .= '/';
        }
        $this->folder = $folder;
    }