Last active
December 25, 2015 02:19
-
-
Save AlexanderC/6901193 to your computer and use it in GitHub Desktop.
Hardcore USSR Framework...
This file contains hidden or 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 | |
class ☭ { | |
protected $☭; | |
public function __call($n, $v) | |
{ | |
$this->☭ or ($this->☭ = (object)[]); | |
@$this->☭->{$n} or ($this->☭->{$n} = []); | |
$this->☭->{$n}[trim(mb_substr($v[0], 0, mb_strpos($v[0], "\n")))] = create_function( | |
trim(mb_substr($v[0], mb_strpos($v[0], "\n"), mb_strpos($v[0], "\n", mb_strpos($v[0], "\n") + 1))), | |
"return " . trim(mb_substr($v[0], mb_strpos($v[0], "\n", mb_strpos($v[0], "\n") + 1))) | |
); | |
return $this; | |
} | |
public function __toString() | |
{ | |
return isset($this->☭->{@$_SERVER['REQUEST_METHOD']}[@$_SERVER['REQUEST_URI']]) | |
? call_user_func_array($this->☭->{@$_SERVER['REQUEST_METHOD']}[@$_SERVER['REQUEST_URI']], $_REQUEST) | |
: 'Resource Not Found'; | |
} | |
} | |
exit((new ☭) | |
->GET(<<<'EOF' | |
/ | |
"<form method='POST'><input name='name'><input type='submit'/></form>"; | |
EOF | |
) | |
->POST(<<<'EOF' | |
/ | |
$name | |
"Hello {$name}"; | |
EOF | |
) | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment