Skip to content

Instantly share code, notes, and snippets.

View TorbenKoehn's full-sized avatar

Torben Köhn TorbenKoehn

View GitHub Profile
<?php
//Methode 1
class Db
{
private $_timeOut = 30;
private $_cache = null;
//...
<?php
//Methode 1
class Model
{
protected $tableName = '';
//Default inflection im ctor?
}
@TorbenKoehn
TorbenKoehn / CustomRenderer.php
Last active April 8, 2016 08:35
Tale Jade custom renderer with Twig-like getters/setters
<?php
class ViewBag
{
private $subject;
public function __construct($subject)
{
<?php
use Psr\Http\Message\ResponseInterface;
use Ion\Http;
use Ion\Http\{
MiddlewareInterface,
Middleware\Dispatcher,
Middleware\RunFilterTrait,
Response
};
<?php
declare(strict_types=1);
namespace Ion\Http\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
class Queue extends \SplQueue
{
<?php
use Psr\Http\Message\ResponseInterface;
use Ion\Http;
use Ion\Http\{
Middleware\Queue,
MiddlewareInterface,
Middleware\Dispatcher,
Middleware\RunFilterTrait,
Response
<?php
class MyCollection
{
//Iterator/ArrayAccess/Countable stuff...
public overload -(array $other)
{
return new self(array_diff($this->items, $other));
<?php
declare(autobox='MyAutoboxer::box');
//All variables coming into this file will be handled through autoboxing
class Autoboxer
{
public static function box(mixed $value)
{
<?php
class Request
{
//...
public function __cast($type) {
<?php
class Column implements Annotation
{
private string $type;
private int $length;
private bool $nullable;
public function __construct(string $type, int $length = null, bool $nullable = false)