An initial dump of ideas for a php generator
- use composer and symfony console tools for cli manipulation
- pluggable architecture
components needed - configuration parsing scanning? (helper for generating definitions) templating
/** | |
* public function set_image | |
* | |
* sets a background image for the splash screen | |
* | |
* @param string $image absolute path to splash background | |
* @return void | |
*/ | |
public function set_image($image) | |
{ |
<?php | |
use Eos\Datastructures\Immutable; | |
use Eos\Datastructures\Struct; | |
class Rectangle extends Struct implements Immutable { | |
public $x; | |
public $y; | |
public $height; | |
public $width; | |
} |
use G\Enum as Enum; | |
<?php | |
class Fruit extends Enum { | |
const Apple = 1; | |
const Pear = 2; | |
const Banana = 3; | |
} | |
$fruit = new Fruit(Fruit::Apple); |
/* {{{ proto array http_parse_query(string encoded_string) | |
parses query string into array */ | |
PHP_FUNCTION(http_parse_query) | |
{ | |
char *arg; | |
int arglen; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { | |
return; | |
} |
#!/usr/bin/env php | |
<?php | |
/* | |
+----------------------------------------------------------------------+ | |
| PHP Version 5 | | |
+----------------------------------------------------------------------+ | |
| Copyright (c) 1997-2010 The PHP Group | | |
+----------------------------------------------------------------------+ | |
| This source file is subject to version 3.01 of the PHP license, | | |
| that is bundled with this package in the file LICENSE, and is | |
<?php | |
error_reporting(E_ALL); | |
define('PHPT_ACL_READ', 1 << 1); | |
define('PHPT_ACL_WRITE', 1 << 2); | |
define('PHPT_ACL_EXEC', 1 << 3); | |
define('PHPT_ACL_NONE', 1 << 4); | |
define('PHPT_ACL_FULL', 1 << 5); | |
define('PHPT_ACL_GRANT', 1); | |
define('PHPT_ACL_DENY', 2); |
<?php | |
define ("PHP_CLI_SERVER_HOSTNAME", "localhost"); | |
define ("PHP_CLI_SERVER_PORT", 8964); | |
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); | |
function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) { | |
$php_executable = getenv('TEST_PHP_EXECUTABLE'); | |
$doc_root = __DIR__; | |
$router = "index.php"; |
An initial dump of ideas for a php generator
components needed - configuration parsing scanning? (helper for generating definitions) templating
<?php | |
$obj1 = new ArrayObject([new ArrayObject([1,2,3]), 1]); | |
unset($obj1[0][0]); |
<?php | |
$url = 'https://verifier.login.persona.org/verify'; | |
$data = 'assertion='.$_POST['assertion'].'&audience=http://persona.localhost:80'; | |
$params = array('http' => array( | |
'method' => 'POST', | |
'content' => $data | |
), | |
'ssl' => array('verify_peer' => true | |
'verify_host' => true)); |