nodes[] = $this->createNode($nodeClass, $activationFunction); } } /** * @param ActivationFunction|null $activationFunction * * @return Neuron */ private function createNode(string $nodeClass, ActivationFunction $activationFunction = null) { if (Neuron::class == $nodeClass) { return new Neuron($activationFunction); } return new $nodeClass(); } public function addNode(Node $node) { $this->nodes[] = $node; } /** * @return Node[] */ public function getNodes() : array { return $this->nodes; } }