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


PHP self类代码示例

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


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

示例1: getEliteFour

 public static function getEliteFour($where = null, $limit = null, $order = ' e.`order`, e.`id` ')
 {
     if (!is_null($where)) {
         $where = 'WHERE ' . $where;
     }
     $getEliteFour = TPP::db()->query("SELECT\n\t\t\te.`id`,\n\t\t\te.`name`,\n\t\t\te.`type`,\n\t\t\te.`attempts`,\n\t\t\te.`wins`,\n\t\t\te.`losses`,\n\t\t\te.`time`,\n\t\t\te.`is_rematch`,\n\t\t\te.`order`,\n\t\t\tGROUP_CONCAT(\n\t\t\t\tDISTINCT CONCAT_WS('" . self::SEPARATOR_2 . "',\n\t\t\t\t\tefp.`id`,\n\t\t\t\t\tefp.`pokemon`,\n\t\t\t\t\tefp.`level`\n\t\t\t\t) SEPARATOR '" . self::SEPARATOR_1 . "'\n\t\t\t) as `pokemon`,\n\t\t\tGROUP_CONCAT(\n\t\t\t\tDISTINCT CONCAT_WS('" . self::SEPARATOR_2 . "',\n\t\t\t\t\tefpm.elite_four_pokemon_id,\n\t\t\t\t\tefpm.name\n\t\t\t\t) SEPARATOR '" . self::SEPARATOR_1 . "'\n\t\t\t) as `moves`\n\t\t\tFROM `elite_four` e\n\t\t\tJOIN `elite_four_pokemon` efp\n\t\t\t\tON efp.`elite_four_id` = e.`id`\n\t\t  \tLEFT JOIN `elite_four_pokemon_move` efpm\n\t\t  \t\tON efpm.`elite_four_pokemon_id` = efp.`id`\n\t\t\t" . $where . "\n\t\t\tGROUP BY e.`id`\n\t\t\tORDER BY " . $order . $limit);
     if (!$getEliteFour) {
         return [];
     }
     $return = [];
     $beaten = $count_e4 = 0;
     while ($eliteFour = $getEliteFour->fetch()) {
         $count_e4++;
         if (isset($eliteFour['time']) && $eliteFour['time'] != '') {
             $beaten++;
         }
         $newE4 = new self();
         $newE4->setAttributes(['id' => (int) $eliteFour['id'], 'name' => $eliteFour['name'], 'type' => $eliteFour['type'], 'attempts' => (int) $eliteFour['attempts'], 'wins' => (int) $eliteFour['wins'], 'losses' => (int) $eliteFour['losses'], 'time' => $eliteFour['time'], 'order' => (int) $eliteFour['order'], 'is_rematch' => (bool) $eliteFour['is_rematch'], 'pokemon' => parent::getPokemonForTrainer($eliteFour['pokemon'], ['id', 'pokemon', 'level'])]);
         $moves = [];
         foreach (explode(self::SEPARATOR_1, $eliteFour['moves']) as $move) {
             $ex = explode(self::SEPARATOR_2, $move);
             $moves[$ex[0]][] = $ex[1];
         }
         foreach ($newE4->pokemon as $p) {
             if (isset($moves[$p->id])) {
                 $p->moves = $p->setMoves($moves[$p->id]);
             }
         }
         $return[] = $newE4;
     }
     return ['beaten' => $beaten === $count_e4, 'elitefour' => $return];
 }
开发者ID:rayrobdod,项目名称:TPP.org,代码行数:32,代码来源:EliteFour.php

示例2: includeTemplate

 /**
  *
  * @param unknown_type $template
  * @param unknown_type $data
  * @return string
  */
 protected function includeTemplate($template, $data = null)
 {
     $view = new self();
     $view->setTemplate($template);
     $view->copyAll($data);
     return $view->render();
 }
开发者ID:rutkoski,项目名称:simplify,代码行数:13,代码来源:Twig.php

示例3: generateRelatedSymptom

 /**
  * @param array $symptoms
  * @param array $exclusions
  * @return string
  */
 public static function generateRelatedSymptom(array $symptoms, array $exclusions = array())
 {
     $instance = new self();
     $symptoms = $instance->applyExclusions($symptoms, $exclusions);
     $symptoms = $instance->invertSymptoms($symptoms);
     return $instance->extractCause($symptoms);
 }
开发者ID:TransformCore,项目名称:HayPersistenceApi,代码行数:12,代码来源:SymptomGenerator.php

示例4: constructFailure

 public static function constructFailure($status, $nwk_addr_of_interest)
 {
     $frame = new self();
     $frame->setStatus($status);
     $frame->setNwkAddrOfInterest($nwk_addr_of_interest);
     return $frame;
 }
开发者ID:CadConsultants,项目名称:zigbee-3,代码行数:7,代码来源:UserDescRspCommand.php

示例5: get_template

 public static function get_template($args = '')
 {
     global $l10n;
     $defaults = array('locale' => null, 'title' => '');
     $args = wp_parse_args($args, $defaults);
     $locale = $args['locale'];
     $title = $args['title'];
     if ($locale) {
         $mo_orig = $l10n['contact-form-7'];
         wpcf7_load_textdomain($locale);
     }
     self::$current = $contact_form = new self();
     $contact_form->title = $title ? $title : __('Untitled', 'contact-form-7');
     $contact_form->locale = $locale ? $locale : get_locale();
     $properties = $contact_form->get_properties();
     foreach ($properties as $key => $value) {
         $properties[$key] = WPCF7_ContactFormTemplate::get_default($key);
     }
     $contact_form->properties = $properties;
     $contact_form = apply_filters('wpcf7_contact_form_default_pack', $contact_form, $args);
     if (isset($mo_orig)) {
         $l10n['contact-form-7'] = $mo_orig;
     }
     return $contact_form;
 }
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:25,代码来源:contact-form.php

示例6: createCivil

 public static function createCivil($input)
 {
     $answer = [];
     $rules = ['number_civil' => 'required', 'date' => 'required', 'demandant' => 'required', 'defendant' => 'required', 'matery' => 'required', 'secretary' => 'required', 'file' => 'required'];
     $validation = Validator::make($input, $rules);
     if ($validation->fails()) {
         $answer['message'] = $validation;
         $answer['error'] = true;
     } else {
         $civil = new self();
         $civil->number_civil = $input['number_civil'];
         $civil->date = $input['date'];
         $civil->demandant = $input['demandant'];
         $civil->defendant = $input['defendant'];
         $civil->matery = $input['matery'];
         $civil->secretary = $input['secretary'];
         $civil->file = $input['file'];
         $civil->references = $input['references'];
         $civil->description = $input['description'];
         $civil->status = 1;
         if ($civil->save()) {
             $answer['message'] = 'Creado con exito!';
             $answer['error'] = false;
         } else {
             $answer['message'] = 'CIVIL CREATE error, team noob!';
             $answer['error'] = false;
         }
     }
     return $answer;
 }
开发者ID:hectorz11,项目名称:laravel_sistema_art,代码行数:30,代码来源:Civil.php

示例7: style

 /**
  * Creates a stylesheet link with LESS support
  *
  * @param   string  $style       file name
  * @param   array   $attributes  default attributes
  * @param   bool    $index       include the index page
  * @param   array   $imports     compare file date for these too, CSS and LESS in style @import
  * @return  string
  */
 public static function style($file, array $attributes = null, $index = false, $imports = null)
 {
     $imports = (array) $imports;
     // Compile only .less files
     if (substr_compare($file, '.less', -5, 5, false) === 0) {
         $css = substr_replace($file, 'css', -4);
         $compiled = is_file($css) ? filemtime($css) : 0;
         try {
             // Check if imported files have changed
             $compile = filemtime($file) > $compiled;
             if (!$compile && !empty($imports)) {
                 foreach ($imports as $import) {
                     if (filemtime($import) > $compiled) {
                         $compile = true;
                         break;
                     }
                 }
             }
             // Compile LESS
             if ($compile) {
                 $compiler = new self($file);
                 file_put_contents($css, $compiler->parse());
             }
             $file = $css;
         } catch (Exception $e) {
             Kohana::$log->add(Kohana::ERROR, __METHOD__ . ': Error compiling LESS file ' . $file . ', ' . $e->getMessage());
         }
     }
     return HTML::style($file . '?' . filemtime($file), $attributes, $index);
 }
开发者ID:netbiel,项目名称:core,代码行数:39,代码来源:less.php

示例8: setEntry

 /**
  * Set option
  *
  * @param $name
  * @param $value
  * @param null $context
  * @param null $type
  * @return bool
  */
 public static function setEntry($name, $value, $context = null, $type = null)
 {
     $item = self::where('name', $name)->first();
     if (!$item) {
         $item = new self();
     }
     $item->name = $name;
     if (!$type) {
         if (is_string($value)) {
             $type = 'string';
         } else {
             $type = 'serializable';
         }
     }
     if ($type == 'serializable') {
         $value = serialize($value);
     } elseif ($type == 'json') {
         $value = json_encode($value);
     } elseif ($type == 'hashed') {
         $value = Hash::make($value);
     } elseif ($type == 'crypted') {
         $value = Crypt::encrypt($value);
     }
     $item->value = $value;
     $item->type = $type;
     $item->context = $context;
     return $item->save();
 }
开发者ID:php-arx,项目名称:arxmin,代码行数:37,代码来源:Option.php

示例9: load

 /**
  * Load an image
  *
  * @param $filename
  * @return Image
  * @throws Exception
  */
 public static function load($filename)
 {
     $instance = new self();
     // Require GD library
     if (!extension_loaded('gd')) {
         throw new Exception('Required extension GD is not loaded.');
     }
     $instance->filename = $filename;
     $info = getimagesize($instance->filename);
     switch ($info['mime']) {
         case 'image/gif':
             $instance->image = imagecreatefromgif($instance->filename);
             break;
         case 'image/jpeg':
             $instance->image = imagecreatefromjpeg($instance->filename);
             break;
         case 'image/png':
             $instance->image = imagecreatefrompng($instance->filename);
             imagesavealpha($instance->image, true);
             imagealphablending($instance->image, true);
             break;
         default:
             throw new Exception('Invalid image: ' . $instance->filename);
             break;
     }
     $instance->original_info = array('width' => $info[0], 'height' => $info[1], 'orientation' => $instance->get_orientation(), 'exif' => function_exists('exif_read_data') ? $instance->exif = @exif_read_data($instance->filename) : null, 'format' => preg_replace('/^image\\//', '', $info['mime']), 'mime' => $info['mime']);
     $instance->width = $info[0];
     $instance->height = $info[1];
     imagesavealpha($instance->image, true);
     imagealphablending($instance->image, true);
     return $instance;
 }
开发者ID:SerdarSanri,项目名称:arx-core,代码行数:39,代码来源:Image.php

示例10: create

 /**
  * Transforms a string or an array to a query object.
  *
  * If query is empty,
  *
  * @param mixed $query
  *
  * @throws \Elastica\Exception\NotImplementedException
  *
  * @return self
  */
 public static function create($query)
 {
     switch (true) {
         case $query instanceof self:
             return $query;
         case $query instanceof AbstractQuery:
             return new self($query);
         case $query instanceof AbstractFilter:
             $newQuery = new self();
             $newQuery->setPostFilter($query);
             return $newQuery;
         case empty($query):
             return new self(new MatchAll());
         case is_array($query):
             return new self($query);
         case is_string($query):
             return new self(new QueryString($query));
         case $query instanceof AbstractSuggest:
             return new self(new Suggest($query));
         case $query instanceof Suggest:
             return new self($query);
     }
     // TODO: Implement queries without
     throw new NotImplementedException();
 }
开发者ID:nnexai,项目名称:Elastica,代码行数:36,代码来源:Query.php

示例11: addChat

 public static function addChat($IDParent, $Type, $Tag, $Text, $IDUser = null)
 {
     $IDChat = parent::addChat($IDParent, $Text, $IDUser);
     $TheChat = new self();
     $Data = array('Tag' => $Tag, 'Type' => $Type);
     return $TheChat->update($Data, "IDChat = '{$IDChat}'");
 }
开发者ID:BGCX262,项目名称:zweer-gdr-svn-to-git,代码行数:7,代码来源:Chat.php

示例12: init

 public static function init($run = true)
 {
     static $console;
     if (!$console) {
         // 实例化console
         $console = new self('Think Console', '0.1');
         // 读取指令集
         if (is_file(CONF_PATH . 'command' . EXT)) {
             $commands = (include CONF_PATH . 'command' . EXT);
             if (is_array($commands)) {
                 foreach ($commands as $command) {
                     if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) {
                         // 注册指令
                         $console->add(new $command());
                     }
                 }
             }
         }
     }
     if ($run) {
         // 运行
         $console->run();
     } else {
         return $console;
     }
 }
开发者ID:GDdark,项目名称:cici,代码行数:26,代码来源:Console.php

示例13: launch

 public static function launch()
 {/*{{{*/
     $fix = new self();
     $fix->mailbox = BeanFinder::get('configs')->aladdinMailbox;
     $content = '';
     try
     {
         //$fix->checkDiseaseHospitalInfo4Baidu();
         //$fix->checkDiseaseInfo4Daidu();
         //$fix->checkDoctorForBaidu();
         //$fix->checkHospitalFacultyDoctorInfo();
         //$fix->checkOfficeDoctor4Baidu();
         //$fix->writeContent2File();
         $fix->synFile();
         $fix->sendEmail();
     }
     catch(Exception $ex)
     {
         $content .= $ex->getMessage();
     }
     if(false == empty($content))
     {
         EmailClient::getInstance()->sendSync($fix->mailbox, "阿拉丁监控脚本异常", $content, $type='text/html');
     }
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:25,代码来源:checkaladdin.php

示例14: initializeByString

 /**
  * Method for object initialization by the string
  * @param string $string response string
  * @return Error error object
  */
 public static function initializeByString($string)
 {
     $object = json_decode($string);
     $Response = new self();
     $Response->setError($object->error);
     return $Response;
 }
开发者ID:alxmsl,项目名称:googleclient,代码行数:12,代码来源:Error.php

示例15: setup_fake_attempt_layout

 /**
  * Set a fake page layout. Used when we test URL generation.
  * @param int $id assumed attempt id.
  * @param string $layout layout to set. Like quiz attempt.layout. E.g. '1,2,0,3,4,0,'.
  * @param array $infos slot numbers which contain 'descriptions', or other non-questions.
  * @return quiz_attempt attempt object for use in unit tests.
  */
 public static function setup_fake_attempt_layout($id, $layout, $infos = array())
 {
     $attempt = new stdClass();
     $attempt->id = $id;
     $attempt->layout = $layout;
     $course = new stdClass();
     $quiz = new stdClass();
     $cm = new stdClass();
     $cm->id = 0;
     $attemptobj = new self($attempt, $quiz, $cm, $course, false);
     $attemptobj->slots = array();
     foreach (explode(',', $layout) as $slot) {
         if ($slot == 0) {
             continue;
         }
         $attemptobj->slots[$slot] = new stdClass();
         $attemptobj->slots[$slot]->slot = $slot;
         $attemptobj->slots[$slot]->requireprevious = 0;
         $attemptobj->slots[$slot]->questionid = 0;
     }
     $attemptobj->sections = array();
     $attemptobj->sections[0] = new stdClass();
     $attemptobj->sections[0]->heading = '';
     $attemptobj->sections[0]->firstslot = 1;
     $attemptobj->sections[0]->shufflequestions = 0;
     $attemptobj->infos = $infos;
     $attemptobj->link_sections_and_slots();
     $attemptobj->determine_layout();
     $attemptobj->number_questions();
     return $attemptobj;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:38,代码来源:attempt_test.php


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