protected function checkStorageId($path, Storage $storage, StorageRepository $rep)
    {
        if (!file_exists($path.StorageListener::ID_FILE)) {
            // path is free. reserve for me
            file_put_contents($path.StorageListener::ID_FILE, $storage->getId());
        } elseif (file_get_contents($path.StorageListener::ID_FILE) == $storage->getId()) {
            // it is my path. do nothing
        } elseif (!($duplicate = $rep->find(file_get_contents($path.StorageListener::ID_FILE)))) {
            // this path is reserved storage that was removed and now this path is free
            file_put_contents($path.StorageListener::ID_FILE, $storage->getId());
        } else {
            return $duplicate;
        }

        return true;
    }
protected function checkStorageId($path, Storage $storage, StorageRepository $rep)
    {
        if (!file_exists($path.StorageListener::ID_FILE)) {
            // path is free. reserve for me
            file_put_contents($path.StorageListener::ID_FILE, $storage->getId());
        } elseif (file_get_contents($path.StorageListener::ID_FILE) == $storage->getId()) {
            // it is my path. do nothing
        } elseif (!($duplicate = $rep->find(file_get_contents($path.StorageListener::ID_FILE)))) {
            // this path is reserved storage that was removed and now this path is free
            file_put_contents($path.StorageListener::ID_FILE, $storage->getId());
        } else {
            return $duplicate;
        }

        return true;
    }
protected function checkStorageId ( $ path , Storage $ storage , StorageRepository $ rep ) { if ( ! file_exists ( $ path . StorageListener :: ID_FILE ) ) { // path is free. reserve for me file_put_contents ( $ path . StorageListener :: ID_FILE , $ storage -> getId ( ) ) ; } elseif ( file_get_contents ( $ path . StorageListener :: ID_FILE ) == $ storage -> getId ( ) ) { // it is my path. do nothing } elseif ( ! ( $ duplicate = $ rep -> find ( file_get_contents ( $ path . StorageListener :: ID_FILE ) ) ) ) { // this path is reserved storage that was removed and now this path is free file_put_contents ( $ path . StorageListener :: ID_FILE , $ storage -> getId ( ) ) ; } else { return $ duplicate ; } return true ; }
Update storage id.

@param string $path
@param Storage $storage
@param StorageRepository $rep

@return Storage|bool
Update storage id .