src/php/Arbit/Periodic/TaskFactory.php
public function factory( $task, $date, Logger $logger )
    {
        if ( !is_file( $path = $this->definitions . '/' . $task . '.xml' ) ||
             !is_readable( $path ) )
        {
            $logger->log(
                "Error reading definition file for task '$task'",
                Logger::ERROR
            );
            return false;
        }

        try
        {
            $taskDefinition = Xml\Document::loadFile( $path );
        }
        catch ( \Arbit\Xml\XmlParserException $e )
        {
            $logger->log(
                "Error parsing definition file for task '$task': " . $e->getMessage(),
                Logger::ERROR
            );
            return false;
        }

        $logger->log(
            "Create task '$task' for scheduled date '" . date( 'r', $date ) . "'.",
            Logger::INFO
        );
        return new Task( $task, $date, $taskDefinition, $this->commandRegistry, $logger );
    }
public function factory( $task, $date, Logger $logger )
    {
        if ( !is_file( $path = $this->definitions . '/' . $task . '.xml' ) ||
             !is_readable( $path ) )
        {
            $logger->log(
                "Error reading definition file for task '$task'",
                Logger::ERROR
            );
            return false;
        }

        try
        {
            $taskDefinition = Xml\Document::loadFile( $path );
        }
        catch ( \Arbit\Xml\XmlParserException $e )
        {
            $logger->log(
                "Error parsing definition file for task '$task': " . $e->getMessage(),
                Logger::ERROR
            );
            return false;
        }

        $logger->log(
            "Create task '$task' for scheduled date '" . date( 'r', $date ) . "'.",
            Logger::INFO
        );
        return new Task( $task, $date, $taskDefinition, $this->commandRegistry, $logger );
    }
public function factory ( $ task , $ date , Logger $ logger ) { if ( ! is_file ( $ path = $ this -> definitions . '/' . $ task . '.xml' ) || ! is_readable ( $ path ) ) { $ logger -> log ( "Error reading definition file for task '$task'" , Logger :: ERROR ) ; return false ; } try { $ taskDefinition = Xml \ Document :: loadFile ( $ path ) ; } catch ( \ Arbit \ Xml \ XmlParserException $ e ) { $ logger -> log ( "Error parsing definition file for task '$task': " . $ e -> getMessage ( ) , Logger :: ERROR ) ; return false ; } $ logger -> log ( "Create task '$task' for scheduled date '" . date ( 'r' , $ date ) . "'." , Logger :: INFO ) ; return new Task ( $ task , $ date , $ taskDefinition , $ this -> commandRegistry , $ logger ) ; }
Factory task

Create a task from its name and schedule date. The additionally passed
logger is also passed to the task.

Returns false, if a task could not be created properly.

@param string $task
@param int $date
@param Logger $logger
@return Task
Factory task