Skip to content

Instantly share code, notes, and snippets.

View msyk's full-sized avatar

Masayuki Nii msyk

View GitHub Profile
@msyk
msyk / router.php
Last active May 15, 2017 11:34 — forked from matsuo/router.php
ローカルでFileMaker Data APIを使って開発する際に利用するPHPのビルトインサーバー用ルータースクリプト
<?php
$url = "http://127.0.0.1:3000" . $_SERVER['REQUEST_URI'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
}
if (in_array($_SERVER['REQUEST_METHOD'], array('PUT', 'DELETE'))) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $_SERVER['REQUEST_METHOD']);
<?php
abstract class Component {
protected $parent = null;
protected $children = array();
protected $name;
abstract function add($child);
abstract function remove($child);
abstract function getChildren();
abstract function print();
}