This file contains 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 | |
return array( | |
'zfr_cors' => array( | |
array( | |
'rule' => '*', | |
'allowed_origins' => array(), | |
'allowed_methods' => array(), | |
// ... | |
), |
This file contains 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
{ | |
"Statement": [ | |
{ | |
"Sid": "Stmt1368092872690", | |
"Action": [ | |
"elasticbeanstalk:Terminate*", | |
"elasticbeanstalk:Delete*" | |
], | |
"Effect": "Deny", | |
"Resource": [ |
This file contains 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 | |
// In the InputCollection class, I have this. | |
// Basically, the issue is that when user called "validate", it should returns a "ValidationResult" object. However, | |
// this method needs to recursively calls each children input collection. BUT I don't want the children input filter to | |
// return a validation result, instead I want them return a simple array of error messages, that will be aggregated by | |
// the top input collection. | |
// | |
// I've thought about having validate(array $data, $context = null, $buildValidationResult = false); | |
// But it's ugly |
This file contains 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 | |
// I need to get a specific key of the array (for instance "c"), and then be able FROM THIS new array, | |
// go back to the previous level | |
$data = array( | |
'a' => 'aaaa', | |
'b' => 'bbbb', | |
'c' => array( | |
'd' => 'dddd', |
This file contains 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 ServiceManager | |
{ | |
protected $cache = array(); | |
protected $factories = array(); | |
public function create($name) | |
{ | |
if (isset($this->factories[$name]) && !isset($this->cache[$name])) { | |
$this->cache[$name] = $this->factories[$name]->createService($this); |
This file contains 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 CompiledFactory2 implements FactoryInterface | |
{ | |
public function createService(ServiceLocatorInterface $sl) | |
{ | |
$a = new A(); | |
$b = $sl->get('A'); | |
return new B(a); | |
} |
This file contains 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 PluginManagerFactory implements FactoryInterface | |
{ | |
public function createService(ServiceLocator $locator, $requestedName) | |
{ | |
// $requestedName is "SlmQueue\Job\JobPluginManager" | |
$pluginManager = new $requestedName(); | |
$configPath = $pluginManager->getConfigPath(); | |
This file contains 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
/** @var InputInterface $input */ | |
foreach ($validationRecursiveIterator as $name => $input) { | |
$input->setValue(isset($data[$name]) ? $data[$name] : null); | |
if ($input->isValid($context)) { | |
continue; | |
} | |
$errorMessages[$name] = $input->getErrorMessages(); |
This file contains 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 | |
/** | |
* This is the config file for ZfrRest. Just drop this file into your config/autoload folder (don't | |
* forget to remove the .dist extension from the file), and configure it as you want | |
*/ | |
return array( | |
'zfr_rest' => array( | |
/** |
This file contains 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 MyFieldset extends Fieldset implements InputFilterProviderInterface | |
{ | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->add(array( | |
'type' => 'Email', | |
'name' => 'email' |