First of all I thought python was madness but it looks like php is the wild west.
<?php
use Creations\Robot;
class RoboticAnimal extends Robot {
use Creations\AnimalMixin;
public function __construct ($speed, $name, $band, $wheels, $age, $weight, $blood_type) {
parent::__construct($name, $band, $wheels);
$this->__constructAnimal(now(), $age, $weight, $blood_type);
$this->speed = $speed;
}
// !! Don't forget to override these on you object that extends RoboticAnimal !!
// There should be a preprocces step to allow this:
// public static $foo = new AnimalTraits("Slug", 69, 420, 9001);
public static $foo = [
"AnimalType": "Slug",
"MaxAmount": 69,
"MatingSpeed": 420,
"PowerLevel": 9001
];
public static $robotTraits = [ "Immortal": true ];
...
}
All the animals need to have these 4 parameters AnimalType
MaxAmount
MatingSpeed
PowerLevel
. So to manage these 4 values we created an AnimalTraits
object because OOP is good, however we cant assign these animal traits instance to our class as seen in the code snippit (and comments).
Is there away to assign an object instance of class to a static member field of a different class? (see comments of static member in code) It seems like this should be possible considering we assign the array, and thats the OOP Way