@param string $direction

@return void
@throws InvalidArgumentException
973417
public static function validate(string $direction)
    {
        if (!isset(self::$directions[$direction])) {
            throw InvalidArgumentException::format(
                    'Invalid ordering direction: expecting one of (%s), \'%s\' given',
                    Debug::formatValues(array_keys(self::$directions)), $direction
            );
        }
    }
1277598
public function setTarget(string $target): void
    {
        $path = realpath($target);
        if (false === $path) {
            if (@mkdir($target, 0755, true)) {
                $path = realpath($target);
            } else {
                throw new InvalidArgumentException(
                    'Target directory (' . $target . ') does not exist and could not be created'
                );
            }
        }

        if (!is_dir($path) || !is_writable($path)) {
            throw new InvalidArgumentException('Given target (' . $target . ') is not a writable directory');
        }

        $this->target = $path;
    }
739035
public function orderBy( $expression, $direction = 'ASC' ) {
		$direction = strtoupper( $direction );
		if ( !in_array( $direction, array( 'ASC', 'DESC' ) ) ) {
			throw new InvalidArgumentException( '$direction has to be either ASC or DESC' );
		}

		$this->expressionValidator->validate( $expression,
			ExpressionValidator::VALIDATE_VARIABLE | ExpressionValidator::VALIDATE_FUNCTION
		);

		$this->usageValidator->trackUsedPrefixes( $expression );
		$this->usageValidator->trackUsedVariables( $expression );
		$this->modifiers['ORDER BY'] = $direction . ' (' . $expression . ')';
	}
439733
protected function setOrderByDirection($direction)
    {
        $direction = strtolower($direction);

        if ($direction == 'desc' || $direction == 'asc') {
            $this->orderByDirection = $direction;
        }
    }
333982
public static function SetDirectory($dir) {
    if (!is_dir($dir)) {
      if (!@\mkdir($dir, 0700, TRUE)) {
        throw new \InvalidArgumentException("dir $dir does not exist and could not be created");
      }
    }

    self::$DIR = realpath($dir);
  }
601419
public function removeLocation(Location $location): void
    {
        if (!$this->locations->contains($location)) {
            throw new \InvalidArgumentException(
                    'The location to remove does not exist');
        }
        $location->setWarehouse(null);
        $this->locations->removeElement($location);
    }
941018
public function sortBy($column, $direction = 'asc')
    {
        $this->sortBy = $column;
        if (in_array(strtolower($direction), array('asc', 'desc'))) {
            $this->sortByDirection = $direction;
        } else {
            $this->sortByDirection = 'asc';
        }
    }
478320
private function buildFieldSortClause(array $values, $direction)
    {
        if (!array_key_exists(1, $values)) {
            throw new InvalidArgumentException(
                'Field sort clause requires ContentType identifier'
            );
        }

        if (!array_key_exists(2, $values)) {
            throw new InvalidArgumentException(
                'Field sort clause requires FieldDefinition identifier'
            );
        }

        return new Field($values[1], $values[2], $direction);
    }
873435
public void setDirection(final int DIRECTION) {
        switch (DIRECTION) {
            case SwingUtilities.SOUTH:
                direction = SwingUtilities.SOUTH;
                break;
            case SwingUtilities.EAST:
                direction = SwingUtilities.EAST;
                break;
            case SwingUtilities.WEST:
                direction = SwingUtilities.WEST;
                break;
            case SwingUtilities.NORTH:
            default:
                direction = SwingUtilities.NORTH;
                break;
        }
        repaint(getInnerBounds());
    }
343799
public function sortBy($field, $direction = 'desc')
    {
        $this->sortByField = $field;

        if (strtolower($direction) === 'asc') {
            $this->sortByDirection = SORT_ASC;
        } else {
            $this->sortByDirection = SORT_DESC;
        }

        return $this;
    }
483745
public function setFromString($coordinates)
    {
        if (!is_string($coordinates)) {
            throw new InvalidArgumentException('The given coordinates should be a string !');
        }

        try {
            $inDecimalDegree = $this->toDecimalDegrees($coordinates);
            $this->setLatitude($inDecimalDegree[0]);
            $this->setLongitude($inDecimalDegree[1]);
        } catch (InvalidArgumentException $e) {
            throw $e;
        }
    }
464703
public function setDirection($direction)
    {
        if ($direction === null) {
            $this->direction = $direction;
            return $this;
        }

        if (!is_string($direction)) {
            throw new InvalidArgumentException(
                'Direction must be a string.'
            );
        }

        $this->direction = strtolower($direction) === 'asc' ? 'ASC' : 'DESC';
        return $this;
    }
8414
public function sortBy(string $field, string $direction = 'asc'): self
    {
        $this->sortBy = [$field, $direction];

        return $this;
    }
567617
public function postFlightCheck($direction = null)
    {
        foreach ($this->tables as $table) {
            if ($table->hasPendingActions()) {
                throw new \RuntimeException('Migration has pending actions after execution!');
            }
        }
    }
421615
public function sortByDefault(string $direction = 'asc'): TableListColumn
    {
        // we check if the method has already been called
        if ($this->getAttribute('tableList')->sortBy || $this->getAttribute('tableList')->sortDir) {
            $errorMessage = 'The « sortByDefault() » method has already been called. '
                            . 'You only can sort a column by default once.';
            throw new ErrorException($errorMessage);
        }
        // we set the sort attribute
        $this->getAttribute('tableList')->sortBy = $this->getAttribute('attribute');
        // we set the sort direction
        $acceptedDirections = ['asc', 'desc'];
        $errorMessage = 'Invalid « $direction » argument for « sortByAttribute() » method. Has to be « asc » or '
                        . '« desc ». « ' . $direction . ' » given.';
        if (! in_array($direction, $acceptedDirections)) {
            throw new InvalidArgumentException($errorMessage);
        }
        $this->getAttribute('tableList')->setAttribute('sortDir', $direction);

        return $this;
    }
1312248
public function order($direction = null)
    {
        if (is_null($direction)) {
            $direction = $this->getOrderDirection();
        } else {
            $this->setOrderDirection($direction);
        }

        // if a direction is set
        if (!empty($direction)) {
            if (!is_string($this->order) && is_callable($this->order)) {
                call_user_func_array($this->order, $this);
            } else {

                $table = $this->getTable();

                // verify that source is a query
                if (!$table->isSourceQueryBuilder()) {
                    throw new \Exception('Table source is not an instance of query builder');
                }

                $table->getSource()->orderBy($this->order, $direction);
            }
        }

        return $this;
    }
456844
public function setRoundingMode($roundingMode)
    {
        if (in_array($roundingMode, RoundingMode::asArray())) {
            $this->roundingMode = $roundingMode;
        } else {
            $msg = "The roundingMode argument must be a value from the RoundingMode enumeration, '" . $roundingMode . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }