當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::lower方法代碼示例

本文整理匯總了PHP中Inflector::lower方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::lower方法的具體用法?PHP Inflector::lower怎麽用?PHP Inflector::lower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inflector的用法示例。


在下文中一共展示了Inflector::lower方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: connexion

 public static function connexion()
 {
     $args = func_get_args();
     $class = '\\Thin\\Db\\' . ucfirst(Inflector::lower(Arrays::first($args)));
     array_shift($args);
     return call_user_func_array([$class, 'instance'], $args);
 }
開發者ID:schpill,項目名稱:thin,代碼行數:7,代碼來源:Db.php

示例2: instance

    public static function instance($model, $db = null, $options = [])
    {
        $db = is_null($db) ? SITE_NAME : $db;
        $class = __NAMESPACE__ . '\\Model\\' . ucfirst(Inflector::lower($model));
        $file = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)) . DS . ucfirst(Inflector::lower($model)) . '.php';
        if (File::exists($file)) {
            require_once $file;
            return new $class();
        }
        if (!class_exists($class)) {
            $code = 'namespace ' . __NAMESPACE__ . '\\Model;' . "\n" . '
    class ' . ucfirst(Inflector::lower($model)) . ' extends \\Thin\\MyOrm
    {
        public $timestamps = false;
        protected $table = "' . Inflector::lower($model) . '";

        public static function boot()
        {
            static::unguard();
        }
    }';
            if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql')) {
                $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql';
                File::mkdir($dir);
            }
            if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)))) {
                $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db));
                File::mkdir($dir);
            }
            File::put($file, '<?php' . "\n" . $code);
            require_once $file;
            return new $class();
        }
    }
開發者ID:schpill,項目名稱:standalone,代碼行數:34,代碼來源:mysql.php

示例3: __call

 public function __call($func, $argv)
 {
     if (substr($func, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         if (isset($argv[0])) {
             $environment = $argv[0];
         } else {
             $environment = APPLICATION_ENV;
         }
         return getConfig($key, $environment);
     } elseif (substr($func, 0, 3) == 'set') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($argv);
         if (isset($argv[1])) {
             $environment = $argv[1];
         } else {
             $environment = 'all';
         }
         setConfig($key, $value, $environment);
         return $this;
     } elseif (substr($func, 0, 3) == 'has') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         if (isset($argv[0])) {
             $environment = $argv[0];
         } else {
             $environment = APPLICATION_ENV;
         }
         return null !== getConfig($key, $environment);
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:33,代碼來源:Configdata.php

示例4: __call

 public function __call($m, $a)
 {
     if (fnmatch('set*', $m)) {
         $k = Inflector::lower(Inflector::uncamelize(lcfirst(substr($m, 3))));
         $v = empty($a) ? true : current($a);
         self::$__events[$this->__ns][$k] = $v;
         return $this;
     } elseif (fnmatch('get*', $m)) {
         $k = Inflector::lower(Inflector::uncamelize(lcfirst(substr($m, 3))));
         if (isset(self::$__events[$this->__ns][$k])) {
             return self::$__events[$this->__ns][$k];
         }
         $default = empty($a) ? null : current($args);
         return $default;
     } elseif (fnmatch('has*', $m)) {
         $k = Inflector::lower(Inflector::uncamelize(lcfirst(substr($m, 3))));
         return isset(self::$__events[$this->__ns][$k]);
     } elseif (fnmatch('clear*', $m)) {
         $k = Inflector::lower(Inflector::uncamelize(lcfirst(substr($m, 5))));
         unset(self::$__events[$this->__ns][$k]);
         return $this;
     } else {
         if (isset(self::$__events[$this->__ns][$m])) {
             $v = self::$__events[$this->__ns][$m];
             if (is_callable($v)) {
                 return call_user_func_array($v, $a);
             } else {
                 return $v;
             }
         }
     }
 }
開發者ID:schpill,項目名稱:standalone,代碼行數:32,代碼來源:custom.php

示例5: tag

 public static function tag($tag, $value = '', $attributes = array())
 {
     $tag = Inflector::lower($tag);
     if ($tag == 'meta') {
         return '<' . $tag . static::attributes($attributes) . ' />';
     }
     return '<' . $tag . static::attributes($attributes) . '>' . static::entities($value) . '</' . $tag . '>';
 }
開發者ID:schpill,項目名稱:thin,代碼行數:8,代碼來源:Html.php

示例6: boot

 public function boot($cb404 = null)
 {
     if (is_null($cb404)) {
         $this->cb404 = function () {
             return ['static', 'is404', true];
         };
     } else {
         $this->cb404 = $cb404;
     }
     list($controllerName, $action, $render) = $this->init();
     Now::set('request.controller', $controllerName);
     Now::set('request.action', $action);
     $controllerFile = path('module') . DS . 'controllers' . DS . $controllerName . '.php';
     if (!is_file($controllerFile)) {
         $controllerFile = path('module') . DS . 'controllers' . DS . 'static.php';
         $action = 'is404';
     }
     if (!is_file($controllerFile)) {
         if (isset($this->cb404) && is_callable($this->cb404)) {
             Now::set('page404', true);
             return call_user_func($this->cb404);
         } else {
             header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
             die;
         }
     }
     require_once $controllerFile;
     $class = '\\Thin\\' . ucfirst(Inflector::lower($controllerName)) . 'Controller';
     $actions = get_class_methods($class);
     $father = get_parent_class($class);
     if ($father == 'Thin\\FrontController') {
         $a = $action;
         $method = $this->getMethod();
         $action = Inflector::lower($method) . ucfirst(Inflector::camelize(strtolower($action)));
         $controller = new $class();
         $controller->_name = $controllerName;
         $controller->action = $a;
         if (in_array('boot', $actions)) {
             $controller->boot();
         }
         if (in_array($action, $actions)) {
             $controller->{$action}();
         } else {
             Clipp::is404();
         }
         if (in_array('unboot', $actions)) {
             $controller->unboot();
         }
     } else {
         $controller = new $class($action);
     }
     if (true === $render) {
         $this->render($controller, Now::get('page404', false));
     }
 }
開發者ID:schpill,項目名稱:standalone,代碼行數:55,代碼來源:routes.php

示例7: __callstatic

 public static function __callstatic($method, $args)
 {
     if (substr($method, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
         $var = Inflector::lower($uncamelizeMethod);
         $return = static::get($var);
         return $return;
     } elseif (substr($method, 0, 3) == 'set') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
         $var = Inflector::lower($uncamelizeMethod);
         $value = current($args);
         return static::set($var, $value);
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:14,代碼來源:Utils.php

示例8: execute

 public static function execute($module, $controller, $action, $args = [])
 {
     $dirModule = APPLICATION_PATH . DS . 'modules' . DS . SITE_NAME . DS . Inflector::lower($module);
     if (!is_dir($dirModule)) {
         throw new Exception("The directory '{$dirModule}' does not exist.");
     }
     $dirController = $dirModule . DS . 'controllers';
     if (!is_dir($dirController)) {
         throw new Exception("The directory '{$dirController}' does not exist.");
     }
     $controllerFile = $dirController . DS . Inflector::lower($controller) . 'Controller.php';
     if (!File::exists($controllerFile)) {
         throw new Exception("The file '{$controllerFile}' does not exist.");
     }
     require_once $controllerFile;
     $oldRoute = container()->getRoute();
     container()->setRoute(with(new Container())->setModule($module)->setController($controller)->setAction($action));
     $controllerClass = 'Thin\\' . Inflector::lower($controller) . 'Controller';
     $controllerInstance = new $controllerClass();
     $actions = get_class_methods($controllerClass);
     if (strstr($action, '-')) {
         $words = explode('-', $action);
         $newAction = '';
         for ($i = 0; $i < count($words); $i++) {
             $word = trim($words[$i]);
             if ($i > 0) {
                 $word = ucfirst($word);
             }
             $newAction .= $word;
         }
         $action = $newAction;
     }
     $actionName = $action . 'Action';
     if (!Arrays::in($actionName, $actions)) {
         throw new Exception("The action '{$actionName}' does not exist in {$controllerFile}.");
     }
     if (Arrays::in('init', $actions)) {
         $controllerInstance->init();
     }
     if (Arrays::in('preDispatch', $actions)) {
         $controllerInstance->preDispatch();
     }
     $res = call_user_func_array([$controllerInstance, $actionName], $args);
     if (Arrays::in('postDispatch', $actions)) {
         $controllerInstance->preDispatch();
     }
     container()->setRoute($oldRoute);
     return $res;
 }
開發者ID:schpill,項目名稱:thin,代碼行數:49,代碼來源:Hmvc.php

示例9: assetBundle

 public static function assetBundle($path = 'css/style.css')
 {
     $route = Utils::get('appDispatch');
     $bundle = $route->getBundle();
     if (!is_null($bundle)) {
         $bpath = realpath(APPLICATION_PATH . '/../');
         $bundle = ucfirst(Inflector::lower($bundle));
         $assetsDir = $bpath . DS . 'bundles' . DS . $bundle . DS . 'public';
         $file = $assetsDir . DS . $path;
         if (File::exists($file)) {
             $url = URLSITE . 'bundles/' . $bundle . '/public/' . $path;
         }
     }
     return URLSITE . '/' . $path;
 }
開發者ID:schpill,項目名稱:thin,代碼行數:15,代碼來源:Route.php

示例10: __construct

 function __construct($var, $forceType = "", $bCollapsed = false)
 {
     //include js and css scripts
     if (!defined('THINDBINIT')) {
         define('THINDBINIT', true);
         $this->initJSandCSS();
     }
     $arrAccept = array("array", "object", "xml");
     //array of variable types that can be "forced"
     $this->bCollapsed = $bCollapsed;
     if (Arrays::inArray($forceType, $arrAccept)) {
         $this->{"varIs" . ucfirst(Inflector::lower($forceType))}($var);
     } else {
         $this->checkType($var);
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:16,代碼來源:Info.php

示例11: __call

 public function __call($func, $argv)
 {
     if (substr($func, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         return getMeta($key);
     } elseif (substr($func, 0, 3) == 'set') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($argv);
         setMeta($key, $value);
         return $this;
     } elseif (substr($func, 0, 3) == 'has') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         return null !== getMeta($key);
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:18,代碼來源:Metadata.php

示例12: dispatch

 public function dispatch($uri)
 {
     if (fnmatch('*/*/*', $uri) && !fnmatch('*/*/*/*', $uri)) {
         list($token, $controller, $action) = explode('/', $uri);
         if (strstr($action, '?')) {
             list($action, $query) = explode('?', $action, 2);
             $query = urldecode($query);
             parse_str($query, $query);
             foreach ($query as $k => $v) {
                 $_REQUEST[$k] = $v;
             }
         }
         $controller = Inflector::lower($controller);
         $action = Inflector::lower($action);
         $dir = Config::get('webservices.dir', APPLICATION_PATH . DS . 'webservices');
         if (is_dir($dir)) {
             $acl = $dir . DS . 'acl.php';
             if (is_file($acl)) {
                 $acl = (include $acl);
                 $userrights = isAke($acl, $token, []);
                 $controllerRights = isAke($userrights, $controller, []);
                 if (in_array($action, $controllerRights)) {
                     $file = $dir . DS . $controller . '.php';
                     if (is_file($file)) {
                         require_once $file;
                         $class = 'Thin\\' . Inflector::camelize($controller . '_webservice');
                         $instance = lib('caller')->make($class);
                         $methods = get_class_methods($instance);
                         if (in_array('init', $methods)) {
                             $instance->init();
                         }
                         if (in_array('boot', $methods)) {
                             $instance->boot();
                         }
                         if (in_array($action, $methods)) {
                             return $instance->{$action}();
                         }
                     }
                 }
             }
         }
     }
     Api::forbidden();
 }
開發者ID:schpill,項目名稱:standalone,代碼行數:44,代碼來源:webservices.php

示例13: boot

 public function boot()
 {
     $uri = $this->getUri();
     list($controllerName, $action, $render) = $this->routes($uri);
     RouterLib::$data['controller'] = $controllerName;
     RouterLib::$data['action'] = $action;
     $controllerFile = Config::get('app.module.dir') . DS . 'controllers' . DS . $controllerName . '.php';
     if (!is_file($controllerFile)) {
         $controllerFile = Config::get('app.module.dir') . DS . 'controllers' . DS . 'static.php';
         $action = 404;
     }
     require_once $controllerFile;
     $class = '\\Thin\\' . ucfirst(Inflector::lower(SITE_NAME)) . ucfirst(Inflector::lower($controllerName)) . 'Controller';
     RouterLib::$request = (new Object())->populate($_REQUEST);
     $controller = new $class($action);
     if (true === $render) {
         self::render($controller);
     }
 }
開發者ID:schpill,項目名稱:standalone,代碼行數:19,代碼來源:router.php

示例14: factory

 public function factory()
 {
     if (File::exists($this->file)) {
         require_once $this->file;
         $instance = new $this->class();
         $methods = get_class_methods($this->class);
         $tab = explode('\\', get_class($instance));
         $item = Inflector::lower(Arrays::last($tab));
         if (Arrays::in('init', $methods)) {
             $instance->init();
         }
         $this->app->bindShared($this->type . '.' . $item, function ($app) use($instance) {
             return $instance;
         });
         return $this;
     } else {
         throw new Exception("The file '{$file}' does not exist.");
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:19,代碼來源:Provider.php

示例15: boot

 public function boot()
 {
     $uri = $this->getUri();
     list($controllerName, $action, $render) = $this->routes($uri);
     Now::set('controller', $controllerName);
     Now::set('action', $action);
     Now::set('session', session(SITE_NAME));
     $controllerFile = Config::get('mvc.dir', APPLICATION_PATH) . DS . 'controllers' . DS . $controllerName . '.php';
     if (!is_file($controllerFile)) {
         $controllerFile = Config::get('mvc.dir', APPLICATION_PATH) . DS . 'controllers' . DS . 'static.php';
         $action = 404;
     }
     require_once $controllerFile;
     $class = '\\Thin\\' . ucfirst(strtolower(SITE_NAME)) . ucfirst(Inflector::lower($controllerName)) . 'Controller';
     Now::set('request', (new Object())->populate($_REQUEST));
     $controller = new $class($action);
     if (true === $render) {
         $this->render($controller);
     }
 }
開發者ID:schpill,項目名稱:standalone,代碼行數:20,代碼來源:routing.php


注:本文中的Inflector::lower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。