src/Jobs/JobFactory.php
public function create(string $className, string $performMethod = 'perform')
    {
        if (class_exists($className) == false) {
            throw new InvalidArgumentException("Could not find job class {$className}.");
        }

        if (method_exists($className, $performMethod) == false) {
            throw new InvalidArgumentException(
                sprintf(
                    'Job class "%s" does not contain perform method "%s".',
                    $className,
                    $performMethod
                )
            );
        }

        $instance = new $className;

        if ($instance instanceof EventsManagerAwareInterface) {
            $instance->setEventsManager($this->getEventsManager());
        }

        return $instance;
    }
public function create(string $className, string $performMethod = 'perform')
    {
        if (class_exists($className) == false) {
            throw new InvalidArgumentException("Could not find job class {$className}.");
        }

        if (method_exists($className, $performMethod) == false) {
            throw new InvalidArgumentException(
                sprintf(
                    'Job class "%s" does not contain perform method "%s".',
                    $className,
                    $performMethod
                )
            );
        }

        $instance = new $className;

        if ($instance instanceof EventsManagerAwareInterface) {
            $instance->setEventsManager($this->getEventsManager());
        }

        return $instance;
    }
Creates the custom job instance.

@param  string $className
@param  string $performMethod
@return mixed

@throws InvalidArgumentException