Skip to content

Instantly share code, notes, and snippets.

@xicond
Created May 16, 2018 02:49
Show Gist options
  • Save xicond/fcd68e2c1dfb19d2c13c9e9ba240e8a9 to your computer and use it in GitHub Desktop.
Save xicond/fcd68e2c1dfb19d2c13c9e9ba240e8a9 to your computer and use it in GitHub Desktop.
sample behavior
<?php
use yii\base\Component;
use yii\base\Behavior;
class api extends Components {
}
class APIBehavior extends Behavior
{
function login(){}
}
class Container extends Components {
private $endpoint1;
public function init (){
$this->endpoint1 = new api;
$this->endpoint1->addBehaviour('auth', new APIBehavior);
}
}
class EContainer extends Container {
private $endpoint2;
public function init (){
$this->endpoint2 = new api;
$this->endpoint2->addBehaviour('auth', new APIBehavior);
}
public function request(){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment