public function getSort($sortName): ?OrderBy
    {
        [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts');

        return array_first($sorts, function ($sort) use ($name) {
            return $sort->getName() === $name;
        });
    }
public function getSort($sortName): ?OrderBy
    {
        [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts');

        return array_first($sorts, function ($sort) use ($name) {
            return $sort->getName() === $name;
        });
    }
public function getSort ( $ sortName ) : ? OrderBy { [ $ name , $ sorts ] = $ this -> getArrayAndKeyName ( $ sortName , 'sorts' ) ; return array_first ( $ sorts , function ( $ sort ) use ( $ name ) { return $ sort -> getName ( ) === $ name ; } ) ; }
It returns single sort by field name

@param string $sortName Sort field name

@throws InvalidArgumentException

@return OrderBy
It returns single sort by field name