public function read() { $file = $this->generatedPath . '/' . $this->configFilename; if (file_exists($file)) { return (array) (require $file); } else { $this->signal->getLogger()->debug('Config file "{file}" does not exists, have you generated signals config file?', ['file' => $file]); } }
public static function create(Signal $signals, $signal, $fqn, $injection) { // Clone signal, as it might be modified by slot $cloned = clone $signal; // Constructor injection if (true === $injection) { $slot = new $fqn($cloned); // Slot aware call if ($cloned instanceof SlotAwareInterface) { $cloned->setSlot($slot); } return $cloned; } // Check if class exists and log if doesn't // @codeCoverageIgnoreStart if (!ClassChecker::exists($fqn)) { $signals->getLogger()->debug(sprintf("Class `%s` not found while emiting signal `%s`", $fqn, get_class($signal))); return false; } // @codeCoverageIgnoreEnd // Other type injection $slot = new $fqn(); // Slot aware call if ($cloned instanceof SlotAwareInterface) { $cloned->setSlot($slot); } if (strstr($injection, '()')) { // Method injection $methodName = str_replace('()', '', $injection); $slot->{$methodName}($cloned); } else { // field injection $slot->{$injection} = $cloned; } return $cloned; }
private function log(Exception $e, $file) { $msg = sprintf('Exception: "%s" while scanning file `%s`', $e->getMessage(), $file); $this->signal->getLogger()->warning($msg); }