Skip to content

Instantly share code, notes, and snippets.

@wizonesolutions
Created November 12, 2016 17:15
Show Gist options
  • Save wizonesolutions/39553d7d434324efc3f329d8ee915904 to your computer and use it in GitHub Desktop.
Save wizonesolutions/39553d7d434324efc3f329d8ee915904 to your computer and use it in GitHub Desktop.
DrupalCamp Oslo 2016
// Copyright (c) 2016 Eirik Morland http://i.giphy.com/3o7TKHyJHIFAXODsmQ.gif
<?php
function print_hello_world() {
print "Hello world!";
}
print_hello_world(); // Prints "Hello world!"
<?php
namespace Long\String\With\Backslashes;
class HelloWorldPrinterFactory implements HelloWorldPrinterFactoryInterface {
public function getHelloWorldPrinter() {
return new HelloWorldPrinter();
}
}
class HelloWorldPrinter implements PrinterInterface {
protected $hello = 'Hello';
protected $world = 'world!';
public function printHelloWorld(Another\String\With\Backslashes\PrintThings $thingPrinter) {
return $thingPrinter->printThing($this->getHello() . ' ' . $this->getWorld());
}
private function getHello() {
return $this->hello;
}
private function getWorld() {
return $this->world;
}
}
new HelloWorldPrinterFactory()
->getHelloWorldPrinter()
->printHelloWorld(new Another\String\With\Backslashes\PrintThings()); // Prints "Hello world!"
@eiriksm
Copy link

eiriksm commented Nov 12, 2016

Copyright?!?!

Trust me, this is licenced with WTFPL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment