first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
class OTGS_Installer_Instance {
/**
* @var string
*/
public $bootfile;
/**
* @var string
*/
public $version;
/**
* @var string
*/
public $high_priority;
/**
* @var bool
*/
public $delegated;
/**
* @param string $bootfile
*
* @return $this
*/
public function set_bootfile( $bootfile ) {
$this->bootfile = $bootfile;
return $this;
}
/**
* @param string $high_priority
*
* @return $this
*/
public function set_high_priority( $high_priority ) {
$this->high_priority = $high_priority;
return $this;
}
/**
* @param string $version
*
* @return $this
*/
public function set_version( $version ) {
$this->version = $version;
return $this;
}
/**
* @param bool $delegated
*
* @return $this
*/
public function set_delegated( $delegated ) {
$this->delegated = (bool) $delegated;
return $this;
}
}

View File

@@ -0,0 +1,10 @@
<?php
class OTGS_Installer_Instances_Factory {
public function create() {
global $wp_installer_instances;
return new OTGS_Installer_Instances( $wp_installer_instances );
}
}

View File

@@ -0,0 +1,32 @@
<?php
class OTGS_Installer_Instances {
private $instances;
/**
* @var OTGS_Installer_Instance[]
*/
private $instances_obj = array();
public function __construct( $instances ) {
$this->instances = $instances;
}
public function get() {
if ( ! $this->instances_obj ) {
foreach( $this->instances as $instance ) {
$instance_obj = new OTGS_Installer_Instance();
$instance_obj->set_bootfile( $instance['bootfile'] )
->set_high_priority( isset( $instance['high_priority'] ) && $instance['high_priority'] )
->set_version( $instance['version'] )
->set_delegated( isset( $instance['delegated'] ) && $instance['delegated'] );
$this->instances_obj[] = $instance_obj;
}
}
return $this->instances_obj;
}
}