每天laravel-20160712|Schedule

php中文网
发布: 2016-06-23 13:10:14
原创
1107人浏览过

<?phpnamespace illuminate\console\scheduling;use symfony\component\process\processutils;use symfony\component\process\phpexecutablefinder;// use namespace.class schedule{    /**     * all of the events on the schedule.     *     * @var array     */    protected $events = [];// events schedule array set to store the events   // by the way, all of this is function or instance of class    /**     * add a new callback event to the schedule.     *     * @param  string  $callback     * @param  array   $parameters     * @return \illuminate\console\scheduling\event     */    public function call($callback, array $parameters = [])    {        $this->events[] = $event = new callbackevent($callback, $parameters);        return $event;    }// get a instance about the event function ,and add it to the events array.    /**     * add a new artisan command event to the schedule.     *     * @param  string  $command     * @param  array  $parameters     * @return \illuminate\console\scheduling\event     */    public function command($command, array $parameters = [])    {        $binary = processutils::escapeargument((new phpexecutablefinder)->find(false));       // change argument        if (defined('hhvm_version')) {            $binary .= ' --php';        }        if (defined('artisan_binary')) {            $artisan = processutils::escapeargument(artisan_binary);        } else {            $artisan = 'artisan';        }        return $this->exec("{$binary} {$artisan} {$command}", $parameters);    }// the author said this is a new artisan command   // suport the hhvm ,good    /**     * add a new command event to the schedule.     *     * @param  string  $command     * @param  array  $parameters     * @return \illuminate\console\scheduling\event     */    public function exec($command, array $parameters = [])    {        if (count($parameters)) {            $command .= ' '.$this->compileparameters($parameters);        }// prepare the command.        $this->events[] = $event = new event($command);// add the instance to the compileparameters        return $event;    }// add a new command event to the schedule    /**     * compile parameters for a command.     *     * @param  array  $parameters     * @return string     */    protected function compileparameters(array $parameters)    {        return collect($parameters)->map(function ($value, $key) {            return is_numeric($key) ? $value : $key.'='.(is_numeric($value) ? $value : processutils::escapeargument($value));        })->implode(' ');    }// compile or change the parameters for you want.    /**     * get all of the events on the schedule.     *     * @return array     */    public function events()    {        return $this->events;    }// big _get    /**     * get all of the events on the schedule that are due.     *     * @param  \illuminate\contracts\foundation\application  $app     * @return array     */    public function dueevents($app)    {        return array_filter($this->events, function ($event) use ($app) {            return $event->isdue($app);        });    }// a super big _get function   // this can get all the events on the schedule that are due.}// at last ,this is a events schedule, that be set bigset get bigget and change the params
登录后复制


天工
天工

昆仑万维推出的通用AI智能体平台,原天工AI

天工 212
查看详情 天工
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号