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 | |
namespace Playbloom\Tests; | |
use Doctrine\DBAL\Driver\PDOMySql\Driver; | |
class MysqlDriver extends Driver | |
{ | |
private static $connection; |
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 | |
$myCountry = // your api call .... | |
echo '<html><head></head><body>' | |
echo $myCountry; | |
echo '</body>'; |
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 | |
$pattern = '#^((\+33[\s|\.]?[1-9]{1})|(0\d{1}))([\s|\.]?[0-9]{2})#'; | |
// $pattern = '#^O{1}#'; | |
// $subpattern = '([\s|\.]?[0-9]{2}){8}'; | |
$samples = [ | |
'+33 1 22 33 44 55', | |
'01 02 03 04 05', |
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 | |
namespace MyLittle\Bundle\BoxBundle\Validator\Constraints; | |
use Symfony\Component\Validator\Constraint; | |
use Symfony\Component\Validator\ConstraintValidator; | |
use Doctrine\Common\Persistence\ManagerRegistry; | |
use MyLittle\Bundle\BoxBundle\Model\ProductInterface; | |
use DomainException; | |
use InvalidArgumentException; |
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 | |
public function testAddBox() | |
{ | |
$package = new Entity\Package(); | |
$box = new \Mock\MyLittle\Bundle\BoxBundle\Entity\Box; | |
$this | |
->object($package->addBox($box)) | |
->isIdenticalTo($package) |
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 | |
use Behat\Symfony2Extension\Context\KernelAwareInterface; | |
use Behat\Symfony2Extension\Context\KernelDictionary; | |
use Behat\MinkExtension\Context\MinkContext; | |
class MysqlContext extends MinkContext implements KernelAwareInterface | |
{ | |
use KernelDictionary; | |
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
<snippet> | |
<content><![CDATA[ | |
/** | |
* Get $1 | |
* | |
* @return ${2:[type]} \$$1 | |
*/ | |
public function get${1/(.*)/\u$1/}() | |
{ | |
return \$this->${1:$SELECTION}; |
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 | |
include(__DIR__ . '/config.php'); | |
use PhpAmqpLib\Connection\AMQPConnection; | |
$exchange = 'router'; | |
$queue = 'msgs'; | |
$consumer_tag = 'consumer'; | |
$conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); |
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 | |
$app['mailer'] = $app->share(function ($app) { | |
$app['mailer.initialized'] = true; | |
return new \Swift_Mailer($app['swiftmailer.transport']); | |
}); | |
$app['mailer']->registerPlugin(new \Swift_Plugins_RedirectingPlugin($config['swiftmailer']['delivery_address'], array('#^'.$config['swiftmailer']['delivery_address'].'$#'))); |
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
// because php sucks at providing custom headers... | |
$headers = apache_request_headers(); | |
if (isset($headers['Authorization'])) { | |
$this->headers->set('Authorization', $headers['Authorization']); | |
} |