Ejemplo n.º 1
0
function forceproto($url)
{
    if (startswith('//', $url)) {
        $url = proto() . ':' . $url;
    }
    return $url;
}
Ejemplo n.º 2
0
        if (parent()->engine->force < 2) {
            echo "Not enough force to fly, give it some gas.\n";
        } else {
            echo "Flying...\n";
        }
    };
    return this();
}, 'plane');
/**
 * This is a derived "amphibious" object of the "car" and "plane" type. It is also a derived
 * of the "vehicle" type because of "car" and "plane". This allows multiple inheritance. This
 * object can "roll" and "fly" without having to implement any logic.
 */
$amphibious = proto(function ($engine) use($car, $plane) {
    proto($car($engine));
    proto($plane($engine));
    return this();
}, 'amphibious');
// We create an engine
$mEngine = clone $engine(8);
// We create a car, give it gas and make it roll
$mCar = clone $car($mEngine);
$mCar->gas();
$mCar->roll();
// We create a plane, give it gas and make it fly
$mPlane = clone $plane($mEngine);
$mPlane->gas();
$mPlane->gas();
$mPlane->fly();
// We create an amphibious vehicle, transfer the plane engine into it, make it roll, then fly
$mAmphib = clone $amphibious($mPlane->engine);
Ejemplo n.º 3
0
 public function getMusicUrl($proto)
 {
     switch ($proto) {
         case 'mp3':
             return proto() . '://cdn.c3voc.de/' . rawurlencode($this->getRoom()->getStream()) . '.mp3';
         case 'opus':
             return proto() . '://cdn.c3voc.de/' . rawurlencode($this->getRoom()->getStream()) . '.opus';
         default:
             return null;
     }
 }