mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Remove Composer Lock. Tweak Commands and Tasks instantiation
This commit is contained in:
		
							parent
							
								
									3908c20d8e
								
							
						
					
					
						commit
						5d95b4d6cb
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,3 @@
 | 
				
			|||||||
/vendor/
 | 
					/vendor/
 | 
				
			||||||
/build
 | 
					/build
 | 
				
			||||||
 | 
					composer.lock
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ use Symfony\Component\Console\Event\ConsoleExceptionEvent;
 | 
				
			|||||||
use Symfony\Component\Console\ConsoleEvents;
 | 
					use Symfony\Component\Console\ConsoleEvents;
 | 
				
			||||||
use Symfony\Component\Console\Application;
 | 
					use Symfony\Component\Console\Application;
 | 
				
			||||||
use Symfony\Component\Yaml\Yaml;
 | 
					use Symfony\Component\Yaml\Yaml;
 | 
				
			||||||
 | 
					use ReflectionClass;
 | 
				
			||||||
use Mage\Runtime\Exception\RuntimeException;
 | 
					use Mage\Runtime\Exception\RuntimeException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -96,8 +97,9 @@ class MageApplication extends Application
 | 
				
			|||||||
        foreach ($finder as $file) {
 | 
					        foreach ($finder as $file) {
 | 
				
			||||||
            $class = substr('\\Mage\\Command\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4);
 | 
					            $class = substr('\\Mage\\Command\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4);
 | 
				
			||||||
            if (class_exists($class)) {
 | 
					            if (class_exists($class)) {
 | 
				
			||||||
 | 
					                $reflex = new ReflectionClass($class);
 | 
				
			||||||
 | 
					                if ($reflex->isInstantiable()) {
 | 
				
			||||||
                    $command = new $class();
 | 
					                    $command = new $class();
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if ($command instanceof AbstractCommand) {
 | 
					                    if ($command instanceof AbstractCommand) {
 | 
				
			||||||
                        $command->setRuntime($this->runtime);
 | 
					                        $command->setRuntime($this->runtime);
 | 
				
			||||||
                        $this->add($command);
 | 
					                        $this->add($command);
 | 
				
			||||||
@ -105,6 +107,7 @@ class MageApplication extends Application
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the Runtime instance to use
 | 
					     * Gets the Runtime instance to use
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@ use Mage\Runtime\Runtime;
 | 
				
			|||||||
use Mage\Runtime\Exception\RuntimeException;
 | 
					use Mage\Runtime\Exception\RuntimeException;
 | 
				
			||||||
use Symfony\Component\Finder\Finder;
 | 
					use Symfony\Component\Finder\Finder;
 | 
				
			||||||
use Symfony\Component\Finder\SplFileInfo;
 | 
					use Symfony\Component\Finder\SplFileInfo;
 | 
				
			||||||
 | 
					use ReflectionClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Task Factory
 | 
					 * Task Factory
 | 
				
			||||||
@ -78,6 +79,8 @@ class TaskFactory
 | 
				
			|||||||
            $task->setOptions($options);
 | 
					            $task->setOptions($options);
 | 
				
			||||||
            return $task;
 | 
					            return $task;
 | 
				
			||||||
        } elseif (class_exists($name)) {
 | 
					        } elseif (class_exists($name)) {
 | 
				
			||||||
 | 
					            $reflex = new ReflectionClass($name);
 | 
				
			||||||
 | 
					            if ($reflex->isInstantiable()) {
 | 
				
			||||||
                $task = new $name();
 | 
					                $task = new $name();
 | 
				
			||||||
                if ($task instanceof AbstractTask) {
 | 
					                if ($task instanceof AbstractTask) {
 | 
				
			||||||
                    $task->setOptions($options);
 | 
					                    $task->setOptions($options);
 | 
				
			||||||
@ -85,6 +88,7 @@ class TaskFactory
 | 
				
			|||||||
                    return $task;
 | 
					                    return $task;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        throw new RuntimeException(sprintf('Invalid task name "%s"', $name));
 | 
					        throw new RuntimeException(sprintf('Invalid task name "%s"', $name));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -101,12 +105,14 @@ class TaskFactory
 | 
				
			|||||||
        foreach ($finder as $file) {
 | 
					        foreach ($finder as $file) {
 | 
				
			||||||
            $class = substr('\\Mage\\Task\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4);
 | 
					            $class = substr('\\Mage\\Task\\BuiltIn\\' . str_replace('/', '\\', $file->getRelativePathname()), 0, -4);
 | 
				
			||||||
            if (class_exists($class)) {
 | 
					            if (class_exists($class)) {
 | 
				
			||||||
 | 
					                $reflex = new ReflectionClass($class);
 | 
				
			||||||
 | 
					                if ($reflex->isInstantiable()) {
 | 
				
			||||||
                    $task = new $class();
 | 
					                    $task = new $class();
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if ($task instanceof AbstractTask) {
 | 
					                    if ($task instanceof AbstractTask) {
 | 
				
			||||||
                        $this->add($task);
 | 
					                        $this->add($task);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user