This file contains 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 | |
call_user_func_array(function($namespaces, $classAliases) { | |
spl_autoload_register(function($class) use ($namespaces, $classAliases) { | |
$class = strtolower($class); | |
$realClass = (isset($classAliases[$class]) === false ? $class : $classAliases[$class]); | |
foreach ($namespaces as $namespace => $mixed) | |
{ |
This file contains 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 | |
namespace mageekguy\atoum\tests\units\fs; | |
require_once __DIR__ . '/../../runner.php'; | |
use | |
mageekguy\atoum, | |
mageekguy\atoum\fs\path as testedClass | |
; |
This file contains 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 | |
namespace classception; | |
class asserter | |
{ | |
protected $actual = null; | |
public function __construct($actual) | |
{ |
This file contains 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 logger | |
{ | |
protected $name = ''; | |
public function __construct($name) | |
{ | |
$this->name = $name; | |
} |
This file contains 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
> Je vous écris afin de paraître dans la liste des blogs sur votre site. | |
> | |
> Comme je vous suis depuis un moment et d'autres blogs également, j'ai décidé d'ouvrir le mien. | |
> Tout nouveau dans la blogosphère PHP, mon blog www.mon.super.blog.de.la.mort s'articule autour du développement web PHP. | |
> En retour, vous serez présent dans la partner box de mon site. | |
La sollicitation n’est pas un bon moyen pour obtenir un backlink de ma part, bien au contraire. | |
Si ton blog a de l’intérêt, s’il apporte une véritable valeur ajoutée par rapport à la « concurrence », il finira par avoir son backling naturellement. | |
Dans le cas contraire, il n’en aura pas. |
This file contains 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
public function acceptClient($clientsSocket) | |
{ | |
$this->pollSocket($clientsSocket)->onRead(array($this, __FUNCTION__)); | |
$clientSocket = new server\socket($this->acceptSocket($clientsSocket), $this); | |
$timeoutHandler = function() use ($clientSocket) { | |
$this->writeInfo('Client ' . $clientSocket->getPeer() . ' timeout!'); | |
$clientSocket->close(); |
This file contains 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
$this->listener->onAcceptTracker(function($tracker) use ($server) { | |
$server->logInfo('tracker ' . $tracker->getNetworkName() . ' knocks on the door'); | |
$tracker | |
->readRequest(new requests\heartbeat()) | |
->onReadRequestOk(function($heartbeat) use ($server, $tracker) { | |
$tracker | |
->setModemId($heartbeat->getModemId()) | |
->writeRequest($heartbeat) | |
->onWriteRequestOk(function($heartbeat) use ($server, $tracker) { |
This file contains 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
#!/bin/sh | |
[ ! -f .tags ] && echo 0 > .tags | |
version=$((`cat .tags`+1)) | |
git tag 0.0.$version | |
echo $version > .tags | |
git push --tags |
This file contains 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
# Indenting and Whitespace | |
Use only tabs, with no space. | |
Lines should have no trailing whitespace at the end. | |
Files should be formatted with \n as the line ending (Unix line endings), not \r\n (Windows line endings). | |
PHP files should be in UTF-8. | |
PHP files should begin with `<?php ` and should not have a end tag (no `?>`). | |
The reasons for this can be summarized as: | |
* Removing it eliminates the possibility for unwanted whitespace at the end of files which can cause "header already sent" errors, XHTML/XML validation issues, and other problems. | |
* The closing delimiter at the end of a file is optional. |
This file contains 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
$this | |
->assert('Server should throw an exception is it can not create its socket') | |
->given( | |
$server = new testedclass(), | |
$infoLogger = new \mock\aixia\ka\at\server\logger(), | |
$this->calling($infoLogger)->log->doesNothing(), | |
$socketTagger = new \mock\aixia\ka\socket\tagger(), | |
$server | |
->setSocketTagger($socketTagger) | |
->setInfoLogger($infoLogger) |