protected function generateId(): int
    {
        if ($this->getId() !== null) {
            return $this->getId();
        }

        $maxIdLength = \mb_strlen((string) PHP_INT_MAX) - 1;

        // try generate unique id for file
        $id = mb_substr(crc32($this->getModelId()), $maxIdLength - self::ID_PATH_HASH_LENGTH)
            . mb_substr(crc32($this->getActualPath()), self::ID_PATH_HASH_LENGTH);

        return (int) $id;
    }
protected function generateId(): int
    {
        if ($this->getId() !== null) {
            return $this->getId();
        }

        $maxIdLength = \mb_strlen((string) PHP_INT_MAX) - 1;

        // try generate unique id for file
        $id = mb_substr(crc32($this->getModelId()), $maxIdLength - self::ID_PATH_HASH_LENGTH)
            . mb_substr(crc32($this->getActualPath()), self::ID_PATH_HASH_LENGTH);

        return (int) $id;
    }
protected function generateId ( ) : int { if ( $ this -> getId ( ) !== null ) { return $ this -> getId ( ) ; } $ maxIdLength = \ mb_strlen ( ( string ) PHP_INT_MAX ) - 1 ; // try generate unique id for file $ id = mb_substr ( crc32 ( $ this -> getModelId ( ) ) , $ maxIdLength - self :: ID_PATH_HASH_LENGTH ) . mb_substr ( crc32 ( $ this -> getActualPath ( ) ) , self :: ID_PATH_HASH_LENGTH ) ; return ( int ) $ id ; }
Returns existed id or generate unique id based on model id and file path.
@return int
Returns existed id or generate unique id based on model id and file path .