Checks the salt position argument

@return void
976249
protected function checkSaltPositionArgument($position): void
    {
        if (!in_array($position, [self::SALT_BEFORE, self::SALT_AFTER])) {
            throw new InvalidArgumentException(sprintf(
                '`%s` is an invalud argument, it has to be `` or ``',
                $position,
                self::SALT_BEFORE,
                self::SALT_AFTER
            ));
        }
    }
896525
public static function getSalt(): string
    {
        $result = '';

        try {
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            Log::warning("Failed to read salt from file");
        }

        if ($result) {
            return $result;
        }

        try {
            $salt = static::generateSalt();
            static::writeSaltToFile($salt);
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            throw new InvalidArgumentException("Failed to regenerate and save new salt: " . $e->getMessage(), 0, $e);
        }
        Log::warning("New salt is generated and stored.  Users might need to logout and clean their cookies.");

        return $result;
    }
603087
public function check()
    {
        if ($this->path[0] == '/') {
            $filename = $this->path;
        } else {
            $filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path);
        }

        if (file_exists($filename)) {
            $isWriteable = is_writeable($filename);
        } else {
            $isWriteable = is_writeable(dirname($filename));
        }

        if (!$isWriteable) {
            if (function_exists('posix_getgroups')) {
                $userID = posix_geteuid();
                $user = posix_getpwuid($userID);

                $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename));
                $currentOwner = posix_getpwuid($currentOwnerID);

                $message = "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is "
                    . "currently owned by '$currentOwner[name]'.  ";

                if ($user['name'] == $currentOwner['name']) {
                    $message .= 'We recommend that you make the file writeable.';
                } else {
                    $groups = posix_getgroups();
                    $groupList = [];
                    foreach ($groups as $group) {
                        $groupInfo = posix_getgrgid($group);
                        if (in_array($currentOwner['name'], $groupInfo['members'])) {
                            $groupList[] = $groupInfo['name'];
                        }
                    }
                    if ($groupList) {
                        $message .= "	We recommend that you make the file group-writeable and change the group to "
                            . "one of these groups:\n - " . implode("\n - ", $groupList)
                            . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename";
                    } else {
                        $message .= "  There is no user-group that contains both the web-server user and the owner "
                            . "of this file.  Change the ownership of the file, create a new group, or temporarily "
                            . "make the file writeable by everyone during the install process.";
                    }
                }
            } else {
                $message = "The webserver user needs to be able to write to this file:\n$filename";
            }

            return [EnvironmentCheck::ERROR, $message];
        }

        return [EnvironmentCheck::OK, ''];
    }
377356
public function checkForRoot()
    {
        // Don't check for root, if we're not logged in.
        if ($this->getCurrentUser() === false) {
            return false;
        }

        // Loop over the users, check if anybody's root.
        foreach ($this->getUsers() as $user) {
            if (in_array('root', $user['roles'])) {
                // We have a 'root' user.
                return true;
            }
        }

        // Make sure the DB is updated. Note, that at this point we currently don't have
        // the permissions to do so, but if we don't, update the DB, we can never add the
        // role 'root' to the current user.
        $this->app['schema']->update();

        // Show a helpful message to the user.
        $this->app['logger.flash']->info(Trans::__('general.phrase.missing-root-jackpot'));

        // If we reach this point, there is no user 'root'. We promote the current user.
        $user = $this->getCurrentUser();

        return $this->addRole($user['id'], 'root');
    }
761646
public function checkArguments()
    {
        $argc = count($this->args);

        $req = 0;
        foreach ($this->setup[$this->command]['args'] as $arg) {
            if (!$arg['required']) {
                break;
            } // last required arguments seen
            $req++;
        }

        if ($req > $argc) {
            throw new Exception("Not enough arguments", Exception::E_OPT_ARG_REQUIRED);
        }
    }
1300127
protected function validateMove($pos)
	{
		if ($this->getLeftValue() <= $pos && $this->getRightValue() >= $pos) {
			
			return false;
//			$dump = static::dump($this);
//			throw new Exception\InvalidOperation("The move not allowed for {$dump} to position $pos");
		}
		
		return true;
	}
995931
protected static function writeSaltToFile(string $salt): void
    {
        static::validateSalt($salt);
        $result = @file_put_contents(static::$saltFile, $salt);

        if (($result === false) || ($result <> strlen($salt))) {
            throw new InvalidArgumentException("Failed to write salt to file [" . static::$saltFile . "]");
        }
    }
599408
protected function createSalt()
    {
        $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./';
        $max = strlen($pool) - 1;
        $salt = '';
        for ($i = 0; $i < $this->saltLength; ++$i) {
            $salt .= $pool[random_int(0, $max)];
        }
        return $salt;
    }
652690
public function check()
    {
        $origStage = Versioned::get_reading_mode();
        Versioned::set_reading_mode(Versioned::LIVE);

        $files = $this->getFiles();
        if ($files) {
            $fileTypeValidateFunc = $this->fileTypeValidateFunc;
            if (method_exists($this, $fileTypeValidateFunc)) {
                $invalidFiles = [];
                $validFiles = [];

                foreach ($files as $file) {
                    if ($this->$fileTypeValidateFunc($file)) {
                        $validFiles[] = $file;
                    } else {
                        $invalidFiles[] = $file;
                    }
                }

                // If at least one file was valid, count as passed
                if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles) < count($files)) {
                    $validFileList = PHP_EOL;
                    foreach ($validFiles as $vf) {
                        $validFileList .= $vf . PHP_EOL;
                    }
                    if ($fileTypeValidateFunc == 'noVidation') {
                        $checkReturn = [
                            EnvironmentCheck::OK,
                            sprintf('At least these file(s) accessible: %s', $validFileList)
                        ];
                    } else {
                        $checkReturn = [
                            EnvironmentCheck::OK,
                            sprintf(
                                'At least these file(s) passed file type validate function "%s": %s',
                                $fileTypeValidateFunc,
                                $validFileList
                            )
                        ];
                    }
                } else {
                    if (count($invalidFiles) == 0) {
                        $checkReturn = [EnvironmentCheck::OK, 'All files valideted'];
                    } else {
                        $invalidFileList = PHP_EOL;
                        foreach ($invalidFiles as $vf) {
                            $invalidFileList .= $vf . PHP_EOL;
                        }

                        if ($fileTypeValidateFunc == 'noVidation') {
                            $checkReturn = [
                                EnvironmentCheck::ERROR,
                                sprintf('File(s) not accessible: %s', $invalidFileList)
                            ];
                        } else {
                            $checkReturn = [
                                EnvironmentCheck::ERROR,
                                sprintf(
                                    'File(s) not passing the file type validate function "%s": %s',
                                    $fileTypeValidateFunc,
                                    $invalidFileList
                                )
                            ];
                        }
                    }
                }
            } else {
                $checkReturn =  array(
                    EnvironmentCheck::ERROR,
                    sprintf("Invalid file type validation method name passed: %s ", $fileTypeValidateFunc)
                );
            }
        } else {
            $checkReturn = array(
                EnvironmentCheck::ERROR,
                sprintf("No files accessible at path %s", $this->path)
            );
        }

        Versioned::set_reading_mode($origStage);

        return $checkReturn;
    }
1313793
public function valid()
    {
        if (is_null($this->current)) {
            $this->next();
        }

        return ! is_null($this->current) && $this->isValidPosition;
    }
70993
protected static function validateSalt(string $salt): void
    {
        if (!ctype_print($salt)) {
            throw new InvalidArgumentException("Salt is not a printable string");
        }

        static::validateSaltMinLength();

        $saltLength = strlen($salt);
        if ($saltLength < static::$saltMinLength) {
            throw new InvalidArgumentException("Salt length of $saltLength characters is less than expected " . static::$saltMinLength);
        }
    }
1158294
public function verifyElements(): void
    {
        $this->context->waitUntilElementIsVisible($this->fields['username']);
        $this->context->waitUntilElementIsVisible($this->fields['password']);

        $this->context->waitUntil(5, function () {
            return '' == $this->context->findElement($this->fields['password'], $this->defaultTimeout)->getValue();
        });
    }
8395
public static function verifyGID($key, $salt, $gid)
	{
		if(self::createGID($key, $salt) == $gid)
			return true;
		else
			return false;
	}
1273556
private function validateSaltLength(string $salt)
    {
        if (\mb_strlen($salt, '8bit') !== self::KEY_SALT_BYTE_LENGTH) {
            throw new InvalidArgumentException('Salt must be ' . self::KEY_SALT_BYTE_LENGTH . ' bytes long');
        }
    }
965192
public function getPosition()
    {
        if ($this->realPos === -1) {
            $this->realPos = ($this->outer->executable === null ? 0 : 1);
            for ($i = 0; $i < $this->position; $i++) {
                $arg = $this->outer->arguments[$i];
                $this->realPos += count($arg->getParts());
            }
        }

        return $this->realPos;
    }
259285
public function isValid() {
		
		$params = $this -> getParameters();
		$file 	= $this -> getFile();

		if(false === isset($params[0])) {
			return trigger_error(sprintf('Missing argument 1 for %s', __METHOD__), E_USER_ERROR);
		}

		if(false === ('-' . intval($params[0]) == '-' . $params[0])) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($params[0])), E_USER_ERROR);
		}

		$dimensions = @getimagesize($file['tmp_name']);

		if(true === is_array($dimensions)) {

			if($dimensions[0] >= $params[0]) {
				return true;
			}
		}

		return false;
	}
548759
private function containsPosition(int $pos): bool {
        return $this->getStart() <= $pos && $pos <= $this->getEndPosition();
    }