for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* User: jensk
* Date: 13-3-2017
* Time: 17:05
*/
namespace library\storage\factories;
class ImageSetFactory
{
* Ceate image set from post values
*
* @param $postValues
* @return \stdClass
* @throws \Exception
public static function createImageSetFromPostValues($postValues)
if (isset($postValues['title'], $postValues['width'], $postValues['height'], $postValues['method'])) {
$imageSetObject = new \stdClass();
$imageSetObject->title = $postValues['title'];
$imageSetObject->slug = slugify($postValues['title']);
$imageSetObject->width = $postValues['width'];
$imageSetObject->height = $postValues['height'];
$imageSetObject->method = $postValues['method'];
return $imageSetObject;
} else {
throw new \Exception('Trying to create image set with invalid data.');
}