This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ResolvableMiddleware | |
{ | |
public function __construct(ContainerInterface $container, $classname) | |
{ | |
$this->container = $container; | |
$this->classname = $classname; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class AbstractRepository | |
{ | |
public function __construct(Model $models) | |
{ | |
$this->models = $models; | |
} | |
public function get(array $options = []) | |
{ | |
if (isset($options['sort'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class CsvExporter | |
{ | |
protected $repository; | |
protected $file; | |
protected $writer; | |
protected $parameters; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait CsvWriter | |
{ | |
private $file; | |
private $writer; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait CsvWriter | |
{ | |
private $file; | |
private $writer; | |
private function setup() | |
{ | |
$this->file = new SplTempFileObject(); | |
$this->writer = Writer::createFromFileObject($this->file); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function setTransformer(TransformerInterface $transformer) | |
{ | |
$this->writer->insertOne($transformer->getHeaders()); | |
$this->writer->addFormatter([$transformer, 'transform']); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait PartialListener | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function isListener($listener) | |
{ | |
return $this === $listener; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace League\Event; | |
abstract class AbstractListener implements ListenerInterface | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function isListener($listener) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace League\Event; | |
interface ListenerInterface | |
{ | |
/** | |
* Handle an event. | |
* | |
* @param EventInterface $event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserExporter | |
{ | |
use CsvWriter; | |
public function __construct(User $users, UserTransformer $transformer) | |
{ | |
$this->setup(); | |
$this->setTransformer($transformer); | |
$this->users = $users; | |
} |