Ejemplo n.º 1
0
<?php

require '../vendor/autoload.php';
$container = new ServiceContainer();
$runner = new ActionRunner($container);
if ($result = $runner->handleWith(STDOUT, $_REQUEST)) {
    var_dump($result);
}
Ejemplo n.º 2
0
                throw new ActionException('Can\'t connect to mail server');
            }
        }
        return $aActionsToRun;
    }
    /**
     * Checks subject patterns and returns matches
     *
     * @param string $_sSubject  Letter subject
     * @param string|array $_xPatterns  Subject pattern or array of patterns
     * @return array|bool False if appropriate subject haven't been found or array of matches
     */
    private function _checkSubjectPatterns($_sSubject, $_xPatterns)
    {
        $aPatterns = !is_array($_xPatterns) ? [$_xPatterns] : $_xPatterns;
        foreach ($aPatterns as $sPattern) {
            $sSubject = trim($_sSubject);
            $sSubject = preg_replace('/ +/', ' ', $sSubject);
            if (preg_match('/' . $sPattern . '/i', $sSubject, $aMatches)) {
                return array_slice($aMatches, 1);
            }
        }
        return false;
    }
}
$oLauncher = new ActionRunner(isset($argv) ? $argv : []);
try {
    $oLauncher->run();
} catch (ActionException $oException) {
    echo $oException->getMessage();
}