Skip to content

Instantly share code, notes, and snippets.

Dennis Ploetner lloc

Block or report user

Report or block lloc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BoundingBox.php
<?php
/**
* Class BoundingBox
*/
class BoundingBox {
/**
* @var float $lat
* @var float $lon
View abstract-method-overriding.php
<?php
namespace wctrn\realloc;
abstract class Option {
abstract function get( int $id );
}
View interface-widening.php
<?php
namespace wctrn\realloc;
interface Thing {
public function the_content( string $content ) : void;
}
class Tag implements Thing {
View exceptions-error-handling.php
<?php
try {
// Something throws an Exception or Error.
} catch ( Throwable $t ) {
// will match only in PHP 7
} catch ( Exception $e ) {
// will be reached in PHP 5
}
View late-static-bindings-page.php
<?php
namespace wctrn\realloc;
require_once 'late-static-bindings-post.php';
class Page extends Post {
public function get_content() {
return 'Hello Turin!';
View late-static-bindings-post.php
<?php
namespace wctrn\realloc;
class Post {
public static function init() {
return new static();
}
View return-types.php
<?php
namespace wctrn\realloc;
class Post {
protected $content;
public function get_content() : string {
return $this->content;
View type-declaration.php
<?php
namespace wctrn\realloc;
class Post {
protected $content;
public function set_content( string $content ) {
$this->content = $content;
View namespace-class.php
<?php
namespace wctrn\realloc;
class Post {
public function get_content() {
return 'Hello World!';
}
}
View namespace-use.php
<?php
require_once 'namespace-class.php';
// Namespace: Using
echo ( new \wctrn\realloc\Post() )->get_content(), PHP_EOL;
// Namespaces: Importing
use \wctrn\realloc\Post;
echo ( new Post() )->get_content(), PHP_EOL;
You can’t perform that action at this time.