当前位置: 首页>>代码示例>>PHP>>正文


PHP get_type函数代码示例

本文整理汇总了PHP中get_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_type函数的具体用法?PHP get_type怎么用?PHP get_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTextFromData

 protected function getTextFromData($data)
 {
     if (!is_array($data)) {
         throw new \RuntimeException('Wrong type of data to markdownify: ' . get_type($data));
     }
     return Yaml::dump($data, 3);
 }
开发者ID:baddum,项目名称:model418,代码行数:7,代码来源:YamlFileRequest.php

示例2: setResolver

 /**
  * @param $callable
  *
  * @throws InvalidResolverException
  */
 public function setResolver($callable)
 {
     if (!is_callable($callable)) {
         throw new InvalidResolverException(s('Routing resolver must be a callable, received "%s".', get_type($callable)));
     }
     $this->resolver = $callable;
 }
开发者ID:weew,项目名称:router,代码行数:12,代码来源:RouteResolver.php

示例3: getTextFromData

 protected function getTextFromData($data)
 {
     if (!is_string($data)) {
         throw new \RuntimeException('Wrong type of data to markdownify: ' . get_type($data));
     }
     return (new MarkdownifyExtra())->parseString($data);
 }
开发者ID:baddum,项目名称:model418,代码行数:7,代码来源:MarkdownFileRequest.php

示例4: run

 public function run(ApplicationInterface $app)
 {
     $connector = Connector::getInstance();
     $connector->setSourcesBasePath(getcwd());
     $matcher = new Matcher();
     // redirect errors to PhpConsole
     \PhpConsole\Handler::getInstance()->start();
     $app->getEventsHandler()->bind('*', function (EventInterface $event) use($app, $connector, $matcher) {
         /**
          * @var $connector \PhpConsole\Connector
          */
         if ($connector->isActiveClient()) {
             $console = \PhpConsole\Handler::getInstance();
             $context = $event->getContext();
             $origin = $event->getOrigin();
             switch (true) {
                 case $event->getName() == 'application.workflow.step.run':
                     $console->debug(sprintf('Starting running step %s', $origin->getName()), 'workflow.step');
                     break;
                 case $event->getName() == 'application.workflow.hook.run':
                     $middleware = $origin->getMiddleware();
                     $console->debug(sprintf('Running Middleware %s (%s)', $middleware->getReference(), $middleware->getDescription()), 'workflow.hook');
                     $this->dumpNotifications($console, $middleware->getNotifications());
                     break;
                 case $matcher->match(ServicesFactory::EVENT_INSTANCE_BUILT . '.*', $event->getName()):
                     $console->debug(sprintf('Built service %s (%s)', $context['serviceSpecs']->getId(), is_object($context['instance']) ? get_class($context['instance']) : get_type($context['instance'])), 'services');
                     break;
                 case $matcher->match($event->getName(), '*.notify.*'):
                     $this->dumpNotifications($console, $event->getContext('notifications'));
                     break;
             }
         }
     });
 }
开发者ID:objective-php,项目名称:devtools-package,代码行数:34,代码来源:PhpConsoleListener.php

示例5: transform

 /**
  * Transforms an array to a csv set of strings
  *
  * @param  array|null $array
  * @return string
  */
 public function transform($array)
 {
     if (!is_array($array)) {
         throw new TransformationFailedException(sprintf('%s is not an array', get_type($array)));
     }
     return implode(',', $array);
 }
开发者ID:stopfstedt,项目名称:TdnPilotBundle,代码行数:13,代码来源:ArrayToStringTransformer.php

示例6: test_load_file

 public function test_load_file()
 {
     $path = path(__DIR__, '/../configs/array.php');
     $driver = new ArrayConfigDriver();
     $config = $driver->loadFile($path);
     $this->assertTrue(get_type($config) == 'array');
     $this->assertEquals(require $path, $config);
 }
开发者ID:weew,项目名称:config,代码行数:8,代码来源:ArrayConfigDriverTest.php

示例7: _create

 /**
  *	Creates a new record and adds it to the DB based on the stuff given in $info
  *	@param	info	Array|Zend_Config		The stuff to put in the DB
  *	@return			$this
  */
 protected function _create($info)
 {
     $info instanceof Zend_Config && ($info = $info->toArray());
     if (!is_array($info)) {
         throw new Kizano_Exception(sprintf('%s::%s(): Argument $info expected type (string), received `%s\'', __CLASS__, __FUNCTION__, get_type($info)));
     }
     foreach ($info as $name => $value) {
         $this[$name] = $value;
     }
     return $this->save();
 }
开发者ID:aldimol,项目名称:zf-sample,代码行数:16,代码来源:Record.php

示例8: invoke

 /**
  * @param IDefinition $definition
  * @param $command
  *
  * @return mixed
  * @throws InvalidCommandHandlerException
  */
 public function invoke(IDefinition $definition, $command)
 {
     $handler = $definition->getHandler();
     if ($this->isValidHandlerClass($handler)) {
         $handler = $this->createHandler($handler);
     }
     if ($this->isValidHandler($handler)) {
         return $this->invokeHandler($handler, $command);
     }
     throw new InvalidCommandHandlerException(s('Handler "%s" must implement method "handle($command)".', is_string($handler) ? $handler : get_type($handler)));
 }
开发者ID:weew,项目名称:commander,代码行数:18,代码来源:CommandHandlerInvoker.php

示例9: getImgPath

function getImgPath($galleryFolder, $destination_folder, $imgName)
{
    $imgPath = '';
    if ($handle = opendir($destination_folder)) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, $imgName) !== false && strpos($file, '_sm') === false) {
                $img = $destination_folder . $file;
                $imgData = base64_encode(file_get_contents($img));
                $imgPath = 'data: ' . get_type($img) . ';base64,' . $imgData;
            }
        }
        closedir($handle);
    }
    return $imgPath;
}
开发者ID:robinjes,项目名称:BYG_webapplication,代码行数:15,代码来源:get_artworks.php

示例10: files

 /**
  * Retrieves the attachments of the specified object
  *
  * @param mixed $object
  * @return WebDev\AttachmentBundle\Attachement\File[]
  */
 public function files($object)
 {
     if (!is_object($object)) {
         throw new Exception("Can't retrieve the attachments of a " . get_type($object));
     }
     $class = new ReflectionClass($object);
     $files = array();
     foreach ($this->reader->getClassAnnotations($class) as $annotation) {
         if (!$annotation instanceof FileAttachment) {
             continue;
         }
         $file = new File($annotation, $object, $this);
         $files[$file->getName()] = $file;
     }
     return $files;
 }
开发者ID:Josiah,项目名称:AttachmentBundle,代码行数:22,代码来源:AttachmentManager.php

示例11: nameConstant

 public static function nameConstant(SpritePackageInterface $package, SpriteImage $sprite)
 {
     $converter = $package->getConstantsConverter();
     if (!empty($converter)) {
         if (!is_callable($converter, true)) {
             throw new RuntimeException('Variable of type `%s` is not callable', get_type($converter));
         }
         $params = [$package, $sprite];
         $name = call_user_func_array($converter, $params);
     } else {
         $name = $sprite->name;
     }
     // Last resort replacements
     $name = preg_replace('~^[0-9]+~', '', $name);
     return str_replace('-', '_', $name);
 }
开发者ID:maslosoft,项目名称:sprite,代码行数:16,代码来源:Namer.php

示例12: invokeRoute

 /**
  * @param IRoute $route
  *
  * @return IHttpResponse
  * @throws InvalidRouteValue
  */
 public function invokeRoute(IRoute $route)
 {
     $invoker = $this->findInvoker($route);
     if ($invoker) {
         $response = $invoker->invoke($route, $this->container);
         if ($response instanceof IHttpResponseHolder) {
             $response = $response->getHttpResponse();
         } else {
             if ($response instanceof IHttpResponseable) {
                 $response = $response->toHttpResponse();
             }
         }
         if (!$response instanceof IHttpResponse) {
             $response = new HttpResponse(HttpStatusCode::OK, $response);
         }
         return $response;
     }
     throw new InvalidRouteValue(s('Could not resolve route value of type %s.', get_type($route->getAction())));
 }
开发者ID:weew,项目名称:router-routes-invoker-container-aware,代码行数:25,代码来源:RoutesInvoker.php

示例13: newSubtitle

 public static function newSubtitle()
 {
     if (!isset($_FILES['newsub_file'])) {
         return null;
     }
     $newsub_amt = count($_FILES['newsub_file']['name']);
     $folder = 'subtitle/';
     $return = array();
     for ($i = 0; $i < $newsub_amt; $i++) {
         $extension = get_type($_FILES['newsub_file']['name'][$i]);
         $name = 'sub_' . strtotime('now') . rand(10000000, 99999999);
         if ($_FILES['newsub_file']['tmp_name'][$i] && $extension == 'srt') {
             $extension = 'srt';
             move_uploaded_file($_FILES['newsub_file']['tmp_name'][$i], UPLOAD_PATH . "{$folder}{$name}.{$extension}");
             $return[$i] = UPLOAD_URL . "{$folder}{$name}.{$extension}";
         } else {
             $return[$i] = null;
         }
     }
     return $return;
 }
开发者ID:jassonlazo,项目名称:GamersInvasion-Peliculas,代码行数:21,代码来源:upload.php

示例14: render_value

function render_value($dbc, $db_name, $name, $with_def = false)
{
    if (strpos($name, $db_name . ':o') === 0) {
        $id = str_replace($db_name . ':o', "", $name);
        $query = "select * from def where id ='{$id}'";
        $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query);
        if ($row = mysqli_fetch_array($result)) {
            $pre_label = $row[name];
            $def = $row[def];
            $result = get_entity_link($id, get_type($dbc, $name) . ':&nbsp;' . $pre_label, $db_name);
            if ($with_def && $def != '') {
                $result .= '&nbsp;<em><small>(' . tcmks_substr($def) . ')' . '</small></em>';
            }
        } else {
            $result = $name;
        }
    } else {
        $result = $name;
    }
    return $result;
}
开发者ID:sdgdsffdsfff,项目名称:docs-1,代码行数:21,代码来源:graph_helper.php

示例15: encode

 /**
  * @param $data
  * @param int $options
  *
  * @return string
  * @throws InvalidDataTypeException
  * @throws JsonEncodeException
  */
 public function encode($data, $options = 0)
 {
     $json = null;
     if ($data instanceof IArrayable) {
         $json = @json_encode($data->toArray(), $options);
     } else {
         if ($data instanceof IJsonable) {
             $json = $data->toJson($options);
         } else {
             if (is_array($data) || is_object($data)) {
                 $json = @json_encode($data, $options);
             } else {
                 throw new InvalidDataTypeException(s('Can not convert data of type "%s" to json.', get_type($data)));
             }
         }
     }
     if ($json === false) {
         throw new JsonEncodeException(json_last_error_msg(), $data);
     }
     return $json;
 }
开发者ID:weew,项目名称:json-encoder,代码行数:29,代码来源:JsonEncoder.php


注:本文中的get_type函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。