private function isExtensionChangedAndIsChangeAllowed($oldName, $newName)
    {
        $user = $this->getUser();
        if ($this->users()->hasRole($user['id'], 'root') || $this->users()->hasRole($user['id'], 'admin')) {
            return true;
        }

        $oldFile = new \SplFileInfo($oldName);
        $newFile = new \SplFileInfo($newName);

        return $oldFile->getExtension() === $newFile->getExtension();
    }
private function isExtensionChangedAndIsChangeAllowed($oldName, $newName)
    {
        $user = $this->getUser();
        if ($this->users()->hasRole($user['id'], 'root') || $this->users()->hasRole($user['id'], 'admin')) {
            return true;
        }

        $oldFile = new \SplFileInfo($oldName);
        $newFile = new \SplFileInfo($newName);

        return $oldFile->getExtension() === $newFile->getExtension();
    }
private function isExtensionChangedAndIsChangeAllowed ( $ oldName , $ newName ) { $ user = $ this -> getUser ( ) ; if ( $ this -> users ( ) -> hasRole ( $ user [ 'id' ] , 'root' ) || $ this -> users ( ) -> hasRole ( $ user [ 'id' ] , 'admin' ) ) { return true ; } $ oldFile = new \ SplFileInfo ( $ oldName ) ; $ newFile = new \ SplFileInfo ( $ newName ) ; return $ oldFile -> getExtension ( ) === $ newFile -> getExtension ( ) ; }
Check that file extensions are not being changed.

@param string $oldName
@param string $newName

@return bool
Check that file extensions are not being changed .