The state of your own hypertext preprocessor
-
Upload
alessandro-nadalin -
Category
Technology
-
view
2.524 -
download
0
description
Transcript of The state of your own hypertext preprocessor
![Page 1: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/1.jpg)
The state ofyour ownhypertext processor
Alessandro Nadalin
27/03/2012
![Page 2: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/2.jpg)
What we had
![Page 3: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/3.jpg)
![Page 4: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/4.jpg)
PEAR / PECL
![Page 5: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/5.jpg)
![Page 6: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/6.jpg)
![Page 7: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/7.jpg)
![Page 8: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/8.jpg)
What we have
![Page 9: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/9.jpg)
![Page 10: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/10.jpg)
![Page 11: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/11.jpg)
![Page 12: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/12.jpg)
What you should look at
![Page 14: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/14.jpg)
Traitshttp://php.net/manual/en/language.oop5.traits.php
![Page 15: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/15.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 16: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/16.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 17: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/17.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 18: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/18.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 19: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/19.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 20: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/20.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 21: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/21.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 22: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/22.jpg)
trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes();} class Person { use XmlConversion; protected function getXmlAttributes() { return ... }} class Log { use XmlConversion; protected function getXmlAttributes() { return ... }} $user = new Person();$user->toXml();$log = new Log();$log->toXml();
![Page 26: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/26.jpg)
<hx:include src="/footer.html"></hx:include>
![Page 27: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/27.jpg)
<hx:include src="/footer.html"></hx:include>
![Page 28: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/28.jpg)
<hx:include src="/footer.html"></hx:include>
![Page 30: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/30.jpg)
{ "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "[email protected]", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "[email protected]", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" }}
![Page 31: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/31.jpg)
{ "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "[email protected]", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "[email protected]", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" }}
![Page 32: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/32.jpg)
{ "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "[email protected]", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "[email protected]", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" }}
![Page 33: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/33.jpg)
{ "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "[email protected]", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "[email protected]", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" }}
![Page 34: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/34.jpg)
wget http://getcomposer.org/composer.phar php composer.phar install
![Page 35: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/35.jpg)
wget http://getcomposer.org/composer.phar php composer.phar install
![Page 36: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/36.jpg)
wget http://getcomposer.org/composer.phar php composer.phar install
![Page 39: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/39.jpg)
<?php require __DIR__ . '/vendor/.composer/autoload.php'; use Symfony\Component\Process\Process; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+');$process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar');$process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer));}); fclose($handle);
![Page 40: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/40.jpg)
<?php require __DIR__ . '/vendor/.composer/autoload.php'; use Symfony\Component\Process\Process; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+');$process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar');$process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer));}); fclose($handle);
![Page 41: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/41.jpg)
<?php require __DIR__ . '/vendor/.composer/autoload.php'; use Symfony\Component\Process\Process; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+');$process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar');$process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer));}); fclose($handle);
![Page 42: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/42.jpg)
<?php require __DIR__ . '/vendor/.composer/autoload.php'; use Symfony\Component\Process\Process; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+');$process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar');$process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer));}); fclose($handle);
![Page 44: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/44.jpg)
<?php use Symfony\Component\Console\Command\Command;use Symfony\Component\Console\Output\OutputInterface;use Symfony\Component\Console\Input\InputInterface;use Symfony\Component\Process\Process; class Install extends Command{ protected $installDir; protected $failingProcess; protected $dependenciesContainer; public function __construct(DependencyContainer $dependenciesContainer) { parent::__construct(); $this->dependenciesContainer = $dependenciesContainer; } protected function execute(InputInterface $input, OutputInterface $output) { if ($this->createInstallationDirectory($output) && $this->downloadComposer($output) && $this->generateJson($output) && $this->install($output)) { $output->writeln('<info>MISSION ACCOMPLISHED</info>'); } else { $output->writeln('<error>Nasty error happened :\'-(</error>'); if ($this->failingProcess instanceOf Process) { $output->writeln('<error>%s</error>', $this->failingProcess->getErrorOutput()); } } } protected function configure() { $this ->setName('install') ; }}
![Page 45: The state of your own hypertext preprocessor](https://reader030.fdocuments.us/reader030/viewer/2022020122/554bbf8bb4c90594278b5092/html5/thumbnails/45.jpg)
وداعا وداعا