Skip to content

Instantly share code, notes, and snippets.

@pmjones
pmjones / gist:1eca32131759ef600051
Last active February 11, 2017 15:28
action extraction
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class Action
{
// specifications to be resolved
protected $input;
protected $domain;
protected $responder;
<?php
class MiddlewareQueue
{
protected $queue = [];
public function add($spec)
{
$this->queue[] = $spec;
}
public function asArray()
{
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
class Dispatcher
{
protected $queue;
protected $resolver;
public function __construct(array $queue, callable $resolver)
<?php
error_reporting(E_ALL|E_STRICT);
class Foo
{
public function zim()
{
}
}
class Bar extends Foo
@pmjones
pmjones / gist:048451f929b75ebe2cf4
Created March 8, 2015 20:47
PHPDocumentor and Markdown
### This command line session ...
$ mkdir phpdoctest
$ cd phpdoctest/
$ git clone git@github.com:auraphp/Aura.Dispatcher
Cloning into 'Aura.Dispatcher'...
remote: Counting objects: 455, done.
remote: Total 455 (delta 0), reused 0 (delta 0), pack-reused 455
Receiving objects: 100% (455/455), 85.18 KiB | 0 bytes/s, done.
Resolving deltas: 100% (265/265), done.
<h1> Aura for PHP</h1>
<dl>
<dt>1. <a href="libraries/">Library Packages</a></dt>
<dd><dl>
<dt>1.1. <a href="libraries/autoload.html#1.1">Aura.Autoload</a></dt>
<dd><dl>
<dt>1.1.1. <a href="libraries/autoload.html#1.1.1">Foreword</a></dt>
<dd><dl>
<dt>1.1.1.1. <a href="libraries/autoload.html#1.1.1.1">Installation</a></dt>
<dt>1.1.1.2. <a href="libraries/autoload.html#1.1.1.2">Quality</a></dt>
PACKAGE=$1
BASE=`pwd`
DIR="${BASE}/Aura.${PACKAGE}"
AUTH="${BASE}/Aura.Auth"
# change to package dir
cd $DIR
git pull
# fix .gitignore and .travis.yml
[15:42:41] <jcarouth> no view object, no care.
[15:42:52] <jcarouth> should have refactored to Smarty
[15:42:58] <GrumpyCanuck> Savant
[15:43:41] <jcarouth> smarty is just a facade to savant i think
[15:44:00] <GrumpyCanuck> I dare you to say that to pmjones' face
[15:44:47] <mfrost503> oh snapz
[15:44:56] <jcarouth> no, i'll pass. I already did some minor trolling of the sort with him at mwphp
[15:44:59] <jcarouth> i got my little joke in
[15:46:00] <chasep_work> Savant and Smarty are different... Honestly, I don't see much difference between Savant and just using inline PHP to create templates
[15:46:21] <elazar> Basically is, just with predefined structure. ;)
<?php
require "../autoload.php";
$pdo = new Aura\Sql\ExtendedPdo('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('CREATE TABLE foo (bar VARCHAR(20))');
$stm = 'INSERT INTO foo (bar) VALUES (:bar)';
<?php
$pdo = new PDO('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('CREATE TABLE foo (bar VARCHAR(20))');
$sth = $pdo->prepare('INSERT INTO foo (bar) VALUES (:bar)');
var_dump($sth);
$sth->execute(array('bar' => 'bar'));
$sth->execute(array('bar' => null));