Skip to content

Instantly share code, notes, and snippets.

View TorbenKoehn's full-sized avatar

Torben Köhn TorbenKoehn

View GitHub Profile
@TorbenKoehn
TorbenKoehn / StringUtil.php
Created August 27, 2015 14:30
StringUtil class of the Tale Framework. Standalone. Provides useful string utilities and ruby-style string inflections for PHP
<?php
/**
* Tale\StringUtil - The Tale Framework
*
* @version 1.0
* @status Beta
* @author Torben Köhn <t.koehn@outlook.com>
*
* This software is distributed under the MIT license.
* A copy of the license has been distributed with this software.
<?php
return [
'db' => [
'host' => 'localhost',
'user' => '<db_user>',
'password' => '<db_password>',
'name' => '<database_name>'
]
];
<?php
//Methode 1
class Model
{
protected $tableName = '';
//Default inflection im ctor?
}
<?php
//Methode 1
class Db
{
private $_timeOut = 30;
private $_cache = null;
//...
@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 Column implements Annotation
{
private string $type;
private int $length;
private bool $nullable;
public function __construct(string $type, int $length = null, bool $nullable = false)
<?php
class MyCollection
{
//Iterator/ArrayAccess/Countable stuff...
public overload -(array $other)
{
return new self(array_diff($this->items, $other));