Skip to content

Instantly share code, notes, and snippets.

View devosc's full-sized avatar

devosc

View GitHub Profile
@devosc
devosc / config.php
Created September 5, 2014 07:48
Aura Request Object Di Config
'Request\Value\Factory' => Aura\Web\Request\Accept\Value\ValueFactory::class,
'Request' => new Service(
Application\Request\Request::class,
[
new Service(Aura\Web\Request\Client::class, [$_SERVER]),
new Service(Aura\Web\Request\Content::class, [$_SERVER]),
new Service(
Aura\Web\Request\Globals::class,
[
new Service(Aura\Web\Request\Values::class, [$_COOKIE]),
@devosc
devosc / Duality.php
Created October 23, 2014 17:32
duality
<?php
namespace Framework\Application;
use Framework\Config\Configuration;
use Duality\Core\DualityException;
use Duality\Core\Container;
use Duality\Structure\Storage;
use Duality\Structure\File\StreamFile;
<?php
namespace Micro;
use Framework\Route\Definition\Builder\Builder;
use Framework\Route\Definition\Definition;
use Framework\Service\Config\Router\Router;
class Micro
implements MicroApplication
@devosc
devosc / demo_call_function.php
Last active August 29, 2015 14:08
Call function
<?php
/**
*
*/
use Blog\Blog;
use Framework\Application\App;
use Framework\View\Manager\ViewManager;
use Request\Request;
use Response\Response;
@devosc
devosc / newInstanceArgs.php
Created November 7, 2014 05:54
Constructor Plugin Arguments
<?php
/**
* @param string $name
* @param array $args
* @return object
*/
protected function newInstanceArgs($name, array $args = [])
{
$class = new ReflectionClass($name);
@devosc
devosc / phpmetrics.js
Created January 4, 2015 15:39
phpmetrics/slimmerjs
//http://slimerjs.org/
var page = require('webpage').create();
page.viewportSize = { width:1280, height:800 };
page.open('http://localhost/phpmetrics.html')
.then(function(){
window.setTimeout(function() {
@devosc
devosc / references.php
Created January 22, 2015 02:01
References
<?php
class MyService {
protected $request;
function __construct($request)
{
$this->request = $request;
}
@devosc
devosc / gist:b645a21f0b52489b67bb
Created February 7, 2015 12:43
apxs -a remove
sed -i 's/\-i \-a \-n php5 libphp5\.la/\-i \-n php5 libphp5\.la/g' Makefile
@devosc
devosc / raw.php
Last active August 29, 2015 14:15
array values instead of container
$config = [
'alias' => [],
'events' => ['Mvc' => [function($route, $request) { var_dump($route, $request); }]],
'services' => [
'Response' => new Response\HttpResponse,
'Route' => new RouteConfig([
'hostname' => 'localhost',
'method' => 'GET',
'path' => '/',
'scheme' => 'http'
@devosc
devosc / hydrate-scoped-callback.php
Created March 23, 2015 14:54
Scoped Hydration Callbacks
protected function hydrate(Config $config, $service)
{
foreach($config->calls() as $method => $value) {
if (is_string($method)) {
if (Args::PROPERTY == $method[0]) {
$service->{substr($method, 1)} = $this->resolve($value);
continue;
}
$service->$method($this->resolve($value));