src/DataListTrait.php
public function sortBy(string $property, string $order = 'asc'): self
    {
        if ($order !== 'asc' && $order !== 'desc') {
            throw new \InvalidArgumentException('The order argument \'asc\' or \'desc\'');
        }
        $this->internalDataListActions[] = ['sortBy', $property, $order];
        return $this;
    }
public function sortBy(string $property, string $order = 'asc'): self
    {
        if ($order !== 'asc' && $order !== 'desc') {
            throw new \InvalidArgumentException('The order argument \'asc\' or \'desc\'');
        }
        $this->internalDataListActions[] = ['sortBy', $property, $order];
        return $this;
    }
public function sortBy ( string $ property , string $ order = 'asc' ) : self { if ( $ order !== 'asc' && $ order !== 'desc' ) { throw new \ InvalidArgumentException ( 'The order argument \'asc\' or \'desc\'' ) ; } $ this -> internalDataListActions [ ] = [ 'sortBy' , $ property , $ order ] ; return $ this ; }
Sorts the elements of the list by specific property.

@param string $property The property name.
@param string $order The sort order.
@return self A reference to the list.
@throws \InvalidArgumentException
Sorts the elements of the list by specific property .