24 if (!
$source instanceof \DOMDocument) {
28 $groups =
$source->getElementsByTagName(
'group');
29 foreach ($groups as
$group) {
31 if (!
$group->hasAttribute(
'id')) {
32 throw new \InvalidArgumentException(
'Attribute "id" does not exist');
35 foreach (
$group->childNodes as $jobConfig) {
36 if ($jobConfig->nodeName !=
'job') {
39 $jobName = $jobConfig->getAttribute(
'name');
42 throw new \InvalidArgumentException(
'Attribute "name" does not exist');
47 $config += $this->convertCronSchedule($jobConfig);
48 $config += $this->convertCronConfigPath($jobConfig);
65 $instanceName = $jobConfig->getAttribute(
'instance');
66 $methodName = $jobConfig->getAttribute(
'method');
68 if (!isset($instanceName)) {
69 throw new \InvalidArgumentException(
'Attribute "instance" does not exist');
71 if (!isset($methodName)) {
72 throw new \InvalidArgumentException(
'Attribute "method" does not exist');
75 return [
'instance' => $instanceName,
'method' => $methodName];
84 protected function convertCronSchedule(\DOMElement $jobConfig)
88 foreach ($jobConfig->childNodes as $schedules) {
89 if ($schedules->nodeName ==
'schedule') {
90 if (!empty($schedules->nodeValue)) {
91 $result[
'schedule'] = $schedules->nodeValue;
107 protected function convertCronConfigPath(\DOMElement $jobConfig)
111 foreach ($jobConfig->childNodes as $schedules) {
112 if ($schedules->nodeName ==
'config_path') {
113 if (!empty($schedules->nodeValue)) {
114 $result[
'config_path'] = $schedules->nodeValue;
convertCronConfig(\DOMElement $jobConfig)