1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-10 07:06:45 +02:00

feat(entries): rename method rename() to move()

BREAKING CHANGES

- USE move() INSTEAD OF rename()
This commit is contained in:
Awilum
2020-10-17 12:57:31 +03:00
parent d066334fb1
commit 3f9c996942

View File

@@ -190,7 +190,7 @@ class Entries
}
/**
* Rename entry
* Move entry
*
* @param string $id Unique identifier of the entry(entries).
* @param string $new_id New Unique identifier of the entry(entries).
@@ -199,17 +199,17 @@ class Entries
*
* @access public
*/
public function rename(string $id, string $new_id): bool
public function move(string $id, string $new_id): bool
{
// Store data
$this->storage['rename']['id'] = $id;
$this->storage['rename']['new_id'] = $new_id;
$this->storage['move']['id'] = $id;
$this->storage['move']['new_id'] = $new_id;
// Run event: onEntryRename
flextype('emitter')->emit('onEntryRename');
flextype('emitter')->emit('onEntryMove');
if (! $this->has($this->storage['rename']['new_id'])) {
return rename($this->getDirectoryLocation($this->storage['rename']['id']), $this->getDirectoryLocation($this->storage['rename']['new_id']));
if (! $this->has($this->storage['move']['new_id'])) {
return flextype('filesystem')->directory($this->getDirectoryLocation($this->storage['move']['id']))->move($this->getDirectoryLocation($this->storage['move']['new_id']));
}
return false;