Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/File/Writer/DefaultWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function write(array $files)
/**
* Writes a set of files to an output
*
* @param League\Flysystem\FilesystemInterface $filesystem a filesystem wrapper
* @param \League\Flysystem\FilesystemInterface $filesystem a filesystem wrapper
* @param string $file a full path to a temp file
* @param string $path that path to which the file should be written
* @return bool
Expand All @@ -114,7 +114,7 @@ public function writeFile(FilesystemInterface $filesystem, $file, $path)
/**
* Deletes a path from a filesystem
*
* @param League\Flysystem\FilesystemInterface $filesystem a filesystem writer
* @param \League\Flysystem\FilesystemInterface $filesystem a filesystem writer
* @param string $path the path that should be deleted
* @return bool
*/
Expand All @@ -134,7 +134,7 @@ public function deletePath(FilesystemInterface $filesystem, $path)
*
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @return League\Flysystem\FilesystemInterface
* @return \League\Flysystem\FilesystemInterface
*/
public function getFilesystem($field, array $settings = [])
{
Expand Down
26 changes: 12 additions & 14 deletions src/Model/Behavior/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function initialize(array $config)
/**
* Modifies the data being marshalled to ensure invalid upload data is not inserted
*
* @param Event $event an event instance
* @param ArrayObject $data data being marshalled
* @param ArrayObject $options options for the current event
* @param \Cake\Event\Event $event an event instance
* @param \ArrayObject $data data being marshalled
* @param \ArrayObject $options options for the current event
* @return void
*/
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
Expand All @@ -67,7 +67,7 @@ public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $opti
* @param \Cake\Event\Event $event The beforeSave event that was fired
* @param \Cake\ORM\Entity $entity The entity that is going to be saved
* @param \ArrayObject $options the options passed to the save method
* @return bool
* @return void|false
*/
public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
{
Expand All @@ -92,18 +92,17 @@ public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
$entity->set(Hash::get($settings, 'fields.size', 'size'), $data['size']);
$entity->set(Hash::get($settings, 'fields.type', 'type'), $data['type']);
}
return true;
}

/**
* Retrieves an instance of a path processor which knows how to build paths
* for a given file upload
*
* @param \Cake\ORM\Entity $entity an entity
* @param array $data the data being submitted for a save
* @param array $data the data being submitted for a save
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @return Josegonzalez\Upload\File\Path\AbstractProcessor
* @param array $settings the settings for the current field
* @return \Josegonzalez\Upload\File\Path\AbstractProcessor
*/
public function getPathProcessor(Entity $entity, $data, $field, $settings)
{
Expand All @@ -119,15 +118,14 @@ public function getPathProcessor(Entity $entity, $data, $field, $settings)
));
}


/**
* Retrieves an instance of a file writer which knows how to write files to disk
*
* @param \Cake\ORM\Entity $entity an entity
* @param array $data the data being submitted for a save
* @param array $data the data being submitted for a save
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @return Josegonzalez\Upload\File\Path\AbstractProcessor
* @param array $settings the settings for the current field
* @return \Josegonzalez\Upload\File\Path\AbstractProcessor
*/
public function getWriter(Entity $entity, $data, $field, $settings)
{
Expand Down Expand Up @@ -159,9 +157,9 @@ public function getWriter(Entity $entity, $data, $field, $settings)
* create the source files.
*
* @param \Cake\ORM\Entity $entity an entity
* @param array $data the data being submitted for a save
* @param array $data the data being submitted for a save
* @param string $field the field for which data will be saved
* @param array $settings the settings for the current field
* @param array $settings the settings for the current field
* @param string $basepath a basepath where the files are written to
* @return array key/value pairs of temp files mapping to their names
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Model/Behavior/UploadBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function testBeforeSaveUploadError()
->method('get')
->with('field')
->will($this->returnValue($this->dataError['field']));
$this->assertTrue($behavior->beforeSave(new Event('fake.event'), $this->entity, new ArrayObject));
$this->assertNull($behavior->beforeSave(new Event('fake.event'), $this->entity, new ArrayObject));
}

public function testBeforeSaveWriteFail()
Expand Down Expand Up @@ -198,7 +198,7 @@ public function testBeforeSaveOk()
->method('write')
->will($this->returnValue(true));

$this->assertTrue($behavior->beforeSave(new Event('fake.event'), $this->entity, new ArrayObject));
$this->assertNull($behavior->beforeSave(new Event('fake.event'), $this->entity, new ArrayObject));
}

public function testGetWriter()
Expand Down