Skip to content

Instantly share code, notes, and snippets.

@AlexanderC
Last active December 25, 2015 02:19
Show Gist options
  • Save AlexanderC/6901193 to your computer and use it in GitHub Desktop.
Save AlexanderC/6901193 to your computer and use it in GitHub Desktop.
Hardcore USSR Framework...
<?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