我正在开发一个 WordPress 插件,我想在其中连接不同的应用程序。我创建了一个“App”类,并用不同的类扩展了“App”类。
现在我想收集这些实例的所有对象,以便将它们列出来。
谁能帮帮我?如果有兴趣,我什至愿意付钱给一个优秀的开发人员,他可以教我这个以供将来发展。期待您的回复。
这是我当前的代码:
class App {
public function __construct( $id, $name, $label, $description, $subscription_id ) {
$this->id = $id;
$this->name = $name;
$this->label = $label;
$this->description = $description;
$this->subscription_id = $subscription_id;
}
}
class App_Vimeo extends App {
public function __construct( $id, $name, $label, $description, $subscription_id ) {
$this->id = $id;
$this->name = $name;
$this->label = $label;
$this->description = $description;
$this->subscription_id = $subscription_id;
}
}
class App_Facebook extends App {
public function __construct( $id, $name, $label, $description, $subscription_id ) {
$this->id = $id;
$this->name = $name;
$this->label = $label;
$this->description = $description;
$this->subscription_id = $subscription_id;
}
}
class Get_Apps {
public function __construct() {
$this->get_apps();
}
public static function get_apps() {
$apps = array();
$apps[] = new App_Vimeo( 1, 'vimeo', 'Vimeo', 'Vimeo app description', 1 );
$apps[] = new App_Facebook( 1, 'facebook', 'Facebook', 'Facebook app description', 1 );
return $apps;
}
}
$apps = Get_Apps::get_apps();
var_dump( $apps );
`