src/php/Arbit/Periodic/Task.php
public function execute()
    {
        foreach ( $this->configuration->command as $config )
        {
            if ( ( $command = $this->commandRegistry->get( $type = $config['type'], $this->logger ) ) === false )
            {
                $this->logger->log(
                    "Failed to instantiate command '$type' - aborting task.",
                    Logger::ERROR
                );
                return Executor::ERROR;
            }

            $this->logger->log( "Execute command '$type'." );
            $this->logger->setCommand( $type );
            try
            {
                $status = $command->run( $config, $this->logger );
            }
            catch ( \Exception $e )
            {
                $this->logger->log( 'Command threw exception: ' . $e->getMessage(), Logger::ERROR );
                $status = 0;
            }
            $this->logger->setCommand();

            switch ( $status )
            {
                case Executor::SUCCESS:
                    $this->logger->log( 'Finished command execution.' );
                    break;

                case Executor::ABORT:
                    $this->logger->log( 'Command aborted execution.' );
                    return Executor::SUCCESS;

                case Executor::ERROR:
                    $this->logger->log( 'Command reported error.', Logger::WARNING );
                    return Executor::ERROR;

                case Executor::RESCHEDULE:
                    $this->logger->log( 'Command requested rescheduled execution.' );
                    return Executor::RESCHEDULE;

                default:
                    $this->logger->log( 'Command returned in unknown state.', Logger::ERROR );
                    return Executor::ERROR;
            }
        }

        return Executor::SUCCESS;
    }
public function execute()
    {
        foreach ( $this->configuration->command as $config )
        {
            if ( ( $command = $this->commandRegistry->get( $type = $config['type'], $this->logger ) ) === false )
            {
                $this->logger->log(
                    "Failed to instantiate command '$type' - aborting task.",
                    Logger::ERROR
                );
                return Executor::ERROR;
            }

            $this->logger->log( "Execute command '$type'." );
            $this->logger->setCommand( $type );
            try
            {
                $status = $command->run( $config, $this->logger );
            }
            catch ( \Exception $e )
            {
                $this->logger->log( 'Command threw exception: ' . $e->getMessage(), Logger::ERROR );
                $status = 0;
            }
            $this->logger->setCommand();

            switch ( $status )
            {
                case Executor::SUCCESS:
                    $this->logger->log( 'Finished command execution.' );
                    break;

                case Executor::ABORT:
                    $this->logger->log( 'Command aborted execution.' );
                    return Executor::SUCCESS;

                case Executor::ERROR:
                    $this->logger->log( 'Command reported error.', Logger::WARNING );
                    return Executor::ERROR;

                case Executor::RESCHEDULE:
                    $this->logger->log( 'Command requested rescheduled execution.' );
                    return Executor::RESCHEDULE;

                default:
                    $this->logger->log( 'Command returned in unknown state.', Logger::ERROR );
                    return Executor::ERROR;
            }
        }

        return Executor::SUCCESS;
    }
Run task

Execute the contained commands

Returns SUCCESS, if either all commands have been run successfully, or
one command intentionally aborted the execution. If one command reports
an error or requests reschuduling execution is aborted and this is
reported to the executor.

@return int