Best Atoum code snippet using child.hasKey
CategoryService.php
Source:CategoryService.php
...26 * @return string27 */28 public function recursive($parentId = 0, $level = 0, $options = null)29 {30 $hasKey = __FUNCTION__ . '_' . $parentId . '_' . $level;31 if (!empty($options)) {32 foreach ($options as $key => $option) {33 $hasKey .= '_' . $key;34 }35 }36 $html = $this->_getHasKeyValue($this->cacheKey, $hasKey);37 if ($html === null) {38 $tag = new Tag();39 $categories = Category::find(["columns" => "id, name, slug, level, parent_id, icon_type, icon, font_class", "order" => "sort ASC, id DESC", "conditions" => "parent_id = " . $parentId . " AND language_id = $this->_lang_id AND subdomain_id = " . $this->_subdomain_id . " AND active='Y' AND deleted = 'N'"]);40 $levelZeroClass = '';41 $levelOneClass = '';42 $aClass = '';43 if (isset($options['level0'])) {44 $levelZeroClass = ' class="level0 horizental"';45 $aClass = ' class="level1"';46 }47 if (isset($options['level1'])) {48 $levelOneClass = ' level1';49 }50 if (isset($options['level2'])) {51 $levelOneClass = ' level2';52 }53 $html = null;54 if (count($categories) > 0) {55 $html .= '<ul'. $levelZeroClass .'>';56 foreach ($categories as $category) {57 $iconType = $category->icon_type;58 $link = ($this->_lang_code == 'vi') ? $tag->site_url($category->slug) : $tag->site_url($this->_lang_code . '/' . $category->slug);59 if ($category->parent_id == $parentId) {60 switch ($level) {61 case '0':62 $icon = 'caret-right';63 break;64 case '1':65 $icon = 'angle-double-right ';66 break;67 case '2':68 $icon = 'angle-right';69 break;70 71 default:72 $icon = 'caret-right';73 break;74 }75 76 $optionChild = [];77 $html.= '<li class="main_category_' . $level . $levelOneClass .'"><a href="' . $link . '"'. $aClass .'>';78 if (!isset($options['level0']) && !isset($options['level1']) && !isset($options['level2'])) {79 $html .= '<i class="fa fa-'. $icon .'" aria-hidden="true"></i>';80 } else {81 if ($iconType == 2 && !empty($category->icon) && file_exists('files/icon/' . $this->_folder . '/' . $category->icon)) {82 $html .= '<img src="/files/icon/'. $this->_folder . '/' . $category->icon .'" alt="'. $category->name .'">';83 } else {84 if ($iconType == 1 && !empty($category->font_class)) {85 $html .= '<i class="fa fa-'. $category->font_class .'"></i>';86 }87 }88 }89 if (isset($options['level0'])) {90 $optionChild = ['level1' => true];91 }92 if (isset($options['level1'])) {93 $optionChild = ['level2' => true];94 }95 $html.= '<span>' . $category->name . '</span></a>';96 $html.= $this->recursive($category->id, $level + 1, $optionChild);97 $html.= '</li>';98 }99 }100 $html .= '</ul>';101 }102 $this->_setHasKeyValue($this->cacheKey, $hasKey, $html);103 }104 105 return $html;106 }107 /**108 * Get multi level category vertical html109 * 110 * @param $parentId111 * @param $level112 * @param $options113 * 114 * @return string115 */116 public function recursiveVerticalMenu($parentId = 0, $options = null)117 {118 $cfDisplayType = $this->config_service->getConfigItemDetail('_cf_select_display_menu_category_left');119 $hasKey = __FUNCTION__ . '_' . $parentId;120 if (!empty($options)) {121 foreach ($options as $key => $option) {122 $hasKey .= '_' . $key;123 }124 }125 $hasKey .= '_' . $cfDisplayType;126 $html = $this->_getHasKeyValue($this->cacheKey, $hasKey);127 if ($html === null) {128 $plus = $cfDisplayType == 1 ? 'minus' : 'plus';129 $display = $cfDisplayType == 1 ? ' style="display:block"' : '';130 $tag = new Tag();131 $categories = Category::find(["columns" => "id, name, slug, level, parent_id, icon_type, icon, font_class", "order" => "sort ASC, id DESC", "conditions" => "parent_id = " . $parentId . " AND subdomain_id = " . $this->_subdomain_id . " AND language_id = $this->_lang_id AND active='Y' AND deleted = 'N'"]);132 $html = null;133 if (count($categories) > 0) {134 $i = 0;135 $html = '<ul'. $display .'>';136 foreach ($categories as $category) {137 $level = (isset($options['type']) && $options['type'] == 'product') ? $category->level + 1 : $category->level;138 $iconType = $category->icon_type;139 switch ($level) {140 case 0:141 if ($iconType == 2 && !empty($category->icon) && file_exists('files/icon/' . $this->_folder . '/' . $category->icon)) {142 $icon = '<img src="/files/icon/'. $this->_folder . '/' . $category->icon .'" alt="'. $category->name .'">';143 } else {144 if ($iconType == 1 && !empty($category->font_class)) {145 $icon = '<i class="fa fa-'. $category->font_class .'"></i>';146 } else {147 $icon = '<i class="fa fa-caret-right"></i>';148 }149 }150 break;151 case 1:152 if ($iconType == 2 && !empty($category->icon) && file_exists('files/icon/' . $this->_folder . '/' . $category->icon)) {153 $icon = '<img src="/files/icon/'. $this->_folder . '/' . $category->icon .'" alt="'. $category->name .'">';154 } else {155 if ($iconType == 1 && !empty($category->font_class)) {156 $icon = '<i class="fa fa-'. $category->font_class .'"></i>';157 } else {158 $icon = '<i class="fa fa-angle-right"></i>';159 }160 }161 162 break;163 case 2:164 if ($iconType == 2 && !empty($category->icon) && file_exists('files/icon/' . $this->_folder . '/' . $category->icon)) {165 $icon = '<img src="/files/icon/'. $this->_folder . '/' . $category->icon .'" alt="'. $category->name .'">';166 } else {167 if ($iconType == 1 && !empty($category->font_class)) {168 $icon = '<i class="fa fa-'. $category->font_class .'"></i>';169 } else {170 $icon = '<i class="fa fa-circle"></i>';171 }172 }173 174 break;175 176 default:177 $icon = '<i class="fa fa-caret-right"></i>';178 break;179 }180 181 if (isset($options['router'])) {182 $link = ($this->_lang_code == 'vi') ? $tag->site_url($options['router'] . '/' . $category->slug) : $tag->site_url($options['router'] . '/' . $this->_lang_code . '/' . $category->slug);183 } else {184 $link = ($this->_lang_code == 'vi') ? $tag->site_url($category->slug) : $tag->site_url($this->_lang_code . '/' . $category->slug);185 }186 187 if ($category->parent_id == $parentId) {188 $html.= '<li><a href="' . $link .'">' . $icon . '<h3>' . $category->name . '</h3></a>';189 190 $child = $this->recursiveVerticalMenu($category->id, $options);191 if ($child != '') {192 $html .= '<span class="subDropdown '. $plus .'"></span>';193 }194 195 $html.= $this->recursiveVerticalMenu($category->id, $options);196 $html.= '</li>';197 }198 $i++;199 }200 $html .= '</ul>';201 }202 $this->_setHasKeyValue($this->cacheKey, $hasKey, $html);203 }204 return $html;205 }206 /**207 * Get recursive category208 *209 * @param int $parentId210 * @param string $space211 * @param array $trees212 * 213 * @return object214 */215 public function recursiveCategory($parentId = 0, $space = "", $trees = array())216 {217 if (!$trees) {218 $trees = [];219 }220 $result = Category::find(["order" => "sort ASC, id DESC", "conditions" => "parent_id = " . $parentId . " AND subdomain_id = " . $this->_subdomain_id . " AND active = 'Y' AND deleted = 'N'"]);221 $treesObj = [];222 if (count($result) > 0) {223 foreach ($result as $row) {224 $trees[] = ['id' => $row->id, 'parent_id' => $row->parent_id, 'level' => $row->level, 'name' => $space . $row->name, 'slug' => $row->slug, ];225 $trees = $this->recursiveCategory($row->id, $space, $trees);226 }227 }228 if (!empty($trees)) {229 foreach ($trees as $tree) {230 $tree = (object)$tree;231 $treesObj[] = $tree;232 }233 }234 return $treesObj;235 }236 /**237 * get recursive category combo menu238 * 239 * @param integer $parentId240 * @param array $result241 * 242 * @return array243 */244 public function recursiveCategoryCombo($parentId = 0, $result = [])245 {246 $hasKey = __FUNCTION__ . '_' . $parentId;247 $result = $this->_getHasKeyValue($this->cacheKey, $hasKey, ['type' => 'array']);248 if ($result === null) {249 $categories = Category::find(["columns" => "id, name, slug, parent_id, level, icon_type, icon, font_class", "order" => "sort ASC, id DESC", "conditions" => "parent_id = $parentId AND subdomain_id = " . $this->_subdomain_id . " AND language_id = $this->_lang_id AND deleted = 'N'"]);250 if (count($categories) > 0) {251 foreach ($categories as $key => $category) {252 $result[] = $category->toArray();253 $categoryChilds = Category::find(["columns" => "id, name, slug, parent_id, level, icon_type, icon, font_class", "order" => "sort ASC, id DESC", "conditions" => "parent_id = " . $category->id . " AND subdomain_id = " . $this->_subdomain_id . " AND language_id = $this->_lang_id AND deleted = 'N'"]);254 if (count($categoryChilds) > 0) {255 /*$objChild = [];256 foreach ($categoryChilds->toArray() as $categoryChild) {257 $objChild[] = $categoryChild;258 }*/259 $result[$key]['child'] = $categoryChilds->toArray();260 }261 // $this->recursiveCategoryCombo($category->id, $result);262 }263 }264 $this->_setHasKeyValue($this->cacheKey, $hasKey, $result);265 }266 267 return $result;268 }269 /**270 * nested list category271 * 272 * @param integer $parentId273 * @return [type] [description]274 */275 public function nestedCategory($parentId = 0)276 {277 $hasKey = __FUNCTION__ . '_' . $parentId;278 $trees = $this->_getHasKeyValue($this->cacheKey, $hasKey, ['type' => 'array']);279 if ($trees === null) {280 $subdomain_id = $this->_subdomain_id;281 $category = Category::findFirst([282 "columns" => "id, name, slug, parent_id, level", "order" => "sort ASC, id DESC",283 "conditions" => "id = " . $parentId . " AND subdomain_id = $subdomain_id AND language_id = $this->_lang_id AND active='Y' AND deleted = 'N'"284 ]);285 286 $trees = [];287 if ($category) {288 if ($category->parent_id != 0) {289 $categoryParent = Category::findFirst([290 'columns' => 'id',291 'conditions' => 'id = '. $category->parent_id .' AND active = "Y"'292 ]);293 if (!$categoryParent) {294 return $trees;295 }296 }297 $category = $category->toArray();298 $trees = array("id" => $category["id"], "parent_id" => $category["parent_id"], "name" => $category["name"], "slug" => $category["slug"], "level" => $category["level"]);299 if ($category["level"] > 0) {300 $trees["parent"] = $this->nestedCategory($category["parent_id"]);301 }302 }303 $this->_setHasKeyValue($this->cacheKey, $hasKey, $trees);304 }305 return $trees;306 }307 public function getCategoryTreeIdOld($parentId = 0, $trees = array())308 {309 $subdomain_id = $this->_subdomain_id;310 if (!$trees) {311 $trees = array();312 }313 $trees[] = $parentId;314 $categories = Category::find(["columns" => "id", "order" => "sort ASC, id DESC", "conditions" => "parent_id = " . $parentId . " AND subdomain_id = $subdomain_id AND active='Y' AND deleted = 'N'"]);315 $treesObj = array();316 if (!empty($categories)) {317 foreach ($categories as $category) {318 $trees[] = $category->id;319 $trees = $this->getCategoryTreeIdOld($category->id, $trees);320 }321 }322 if (!empty($trees)) {323 foreach ($trees as $tree) {324 $treesObj[] = $tree;325 }326 }327 $treesObj = array_unique($treesObj);328 return $treesObj;329 }330 /**331 * get list Category id332 * 333 * @param integer $parentId334 * @param array $trees 335 * @param null|array $options 336 * 337 * @return array 338 */339 public function getCategoryTreeId($parentId = 0, $trees = array(), $options = null)340 {341 $subdomain_id = $this->_subdomain_id;342 $active = (isset($options['notActive']) && $options['notActive'] == true) ? '' : ' AND active = "Y"';343 if ($parentId != 0) {344 $trees[] = $parentId;345 }346 347 $categories = Category::find(["columns" => "id", "conditions" => "subdomain_id = $this->_subdomain_id AND language_id = $this->_lang_id AND parent_id = " . $parentId . $active ." AND deleted = 'N'"]);348 if (count($categories) > 0) {349 foreach ($categories as $category) {350 $trees[] = $category->id;351 $trees = $this->getCategoryTreeId($category->id, $trees, $options);352 }353 }354 $trees = array_unique($trees);355 $trees = array_values($trees);356 return $trees;357 }358 /**359 * Get category parent id equal 0360 *361 * @return mixed362 */363 public function getCategoryParent()364 {365 $hasKey = __FUNCTION__;366 $categories = $this->_getHasKeyValue($this->cacheKey, $hasKey);367 if ($categories === null) {368 $subdomainId = $this->_subdomain_id;369 $categories = Category::find(["columns" => "id, name, slug, icon_type, icon, font_class", "conditions" => "subdomain_id = $subdomainId AND language_id = $this->_lang_id AND parent_id = 0 AND active = 'Y' AND deleted = 'N'", "order" => "sort ASC, id DESC"]);370 $this->_setHasKeyValue($this->cacheKey, $hasKey, $categories);371 }372 373 return $categories;374 }375 public function getCategoryChild($parentId = 0, $options = null)376 {377 $hasKey = __FUNCTION__ . '_' . $parentId;378 if (!empty($options)) {379 foreach ($options as $key => $option) {380 $hasKey .= '_' . $key;381 }382 }383 $categories = $this->_getHasKeyValue($this->cacheKey, $hasKey);384 if ($categories === null) {385 $subdomainId = $this->_subdomain_id;386 $conditions = "subdomain_id = $subdomainId AND parent_id = $parentId AND language_id = $this->_lang_id AND active = 'Y' AND deleted = 'N'";387 if (isset($options['picture']) && $options['picture'] == true) {388 $conditions .= " AND picture = 'Y'";389 }390 $categories = Category::find([391 "columns" => "id, name, slug, banner",392 "conditions" => $conditions,393 "order" => "sort ASC, id DESC"394 ]);395 $this->_setHasKeyValue($this->cacheKey, $hasKey, $categories);396 }397 return $categories;398 }399 /**400 * Get category tree product detail401 *402 * @param int $productId403 * @return mixed404 */405 public function getCategoryProductDetail($productId)406 {407 $hasKey = __FUNCTION__ . '_' . $productId;408 $categories = $this->_getHasKeyValue($this->cacheKey, $hasKey);409 if ($categories === null) {410 $categories = Category::query()->columns(["Modules\Models\Category.id", "name", "slug", "parent_id"])411 ->join("Modules\Models\TmpProductCategory", "tmp.category_id = Modules\Models\Category.id", "tmp")412 ->where("language_id = :language_id:")413 ->andWhere("product_id = :product_id:")414 ->andWhere("active = :active:")415 ->andWhere("deleted = :deleted:")416 ->bind(["language_id" => $this->_lang_id,"product_id" => $productId, "active" => "Y", "deleted" => "N"])417 ->orderBy("level DESC, Modules\Models\Category.id DESC")418 ->execute();419 $this->_setHasKeyValue($this->cacheKey, $hasKey, $categories);420 }421 return $categories;422 }423 /**424 * Get list category type425 * 426 * @param $type427 * @return mixed428 */429 public function getCategoryType($type = 'hot')430 {431 $hasKey = __FUNCTION__ . '_' . $type;432 $categories = $this->_getHasKeyValue($this->cacheKey, $hasKey);433 if ($categories === null) {434 $categories = Category::find([435 "columns" => "id, name, slug, icon_type, icon, banner, banner_md_sole, content, font_class",436 "conditions" => "subdomain_id = $this->_subdomain_id AND language_id = $this->_lang_id AND ". $type ." = 'Y' AND active='Y' AND deleted = 'N'",437 "order" => "sort ASC, id DESC"438 ]);439 $this->_setHasKeyValue($this->cacheKey, $hasKey, $categories);440 $categories = $this->_getHasKeyValue($this->cacheKey, $hasKey);441 }442 return $categories;443 }444 /**445 * Get category group sole446 * 447 * @param string $type448 * @return array 449 */450 public function getCategoryGroupSole($type = 'hot')451 {452 $categories = $this->getCategoryType($type);453 $result = $this->general->arraySlice($categories, 0, 2);454 return $result;...
RedisService.php
Source:RedisService.php
...51 {52 return $this->redisCache->set($key, $value);53 }54 /**55 * Check hExists hasKey in a key56 *57 * @param string $key58 * @param string $hasKey59 * 60 * @return bolean61 */62 public function _hExists($key, $hasKey)63 {64 return $this->redisCache->hExists($key, $hasKey);65 }66 public function _hSet($key, $hasKey, $value)67 {68 $this->redisCache->hSet($key, $hasKey, $value);69 }70 public function _hGet($key, $hasKey)71 {72 $this->redisCache->hGet($key, $hasKey);73 }74 /**75 * delete hashkey subdomain76 * 77 * @param string $subKey [description]78 * @param null|array $options79 * 80 * @return bolean81 */82 public function _deleteHasKey($subKey, $options = null)83 {84 if (isset($options) && $options['subdomain_id']) {85 $subdomain = Subdomain::findFirstById($options['subdomain_id']);86 if ($subdomain) {87 $key = $subKey . ':' . $options['subdomain_id'];88 $keySubName = $subKey . 's:' . $subdomain->name;89 $this->redis->del($key);90 $this->redis->del($keySubName);91 }92 } else {93 $identity = $this->session->get('auth-identity');94 $identityChild = $this->session->get('subdomain-child');95 if (!empty($identity)) {96 if (!empty($identityChild)) {97 $subdomainChildId = $identityChild['subdomain_id'];98 $subdomainChildName = $identityChild['subdomain_name'];99 $key = $subKey . ':' . $subdomainChildId;100 $keySubName = $subKey . 's:' . $subdomainChildName;101 $this->redis->del($key);102 $this->redis->del($keySubName);103 if ($identity['subdomain_id'] != $identityChild['subdomain_id']) {104 $subdomainId = $identity['subdomain_id'];105 $subdomainName = $identity['subdomain_name'];106 $key = $subKey . ':' . $subdomainId;107 $keySubName = $subKey . 's:' . $subdomainName;108 $this->redis->del($key);109 $this->redis->del($keySubName);110 }111 }112 }113 }114 }115 /**116 * Delete all cache key117 *118 * @return bolean119 */120 public function _deleteAll()121 {122 $identity = $this->session->get('auth-identity');123 $identityChild = $this->session->get('subdomain-child');124 if (!empty($identity)) {125 if (!empty($identityChild)) {126 $subdomainChildId = $identityChild['subdomain_id'];127 $redisSubchilds = $this->redis->keys('*sub'. $subdomainChildId .':*');128 if (!empty($redisSubchilds)) {129 $this->redis->del($redisSubchilds);130 }131 if ($identity['subdomain_id'] != $identityChild['subdomain_id']) {132 $subdomainId = $identity['subdomain_id'];133 $redisSubs = $this->redis->keys('*sub'. $subdomainId .':*');134 if (!empty($redisSubs)) {135 $this->redis->del($redisSubs);136 }137 }138 }139 }140 }141 /**142 * hmset hotline key143 * 144 * @param string $key145 * @param array $dates 146 * @param array $hotline147 * @param integer $step 148 * 149 * @return bolean150 */151 public function hmsetKeyHotline($hotlineKey, $dates, $hotlines = [], $step = 4)152 {153 if (count($hotlines) > 1) {154 // chunk all array / 4155 foreach (array_chunk($dates, $step) as $key => $value) {156 // loop 4 days get one hotline157 for ($i = 0; $i < $step; $i++) { 158 $hotline[] = $hotlines[$key % count($hotlines)];159 }160 }161 162 // remove array value null and sort key again163 $hotline = array_values(array_filter($hotline));164 $dateHotlines = [];165 foreach ($dates as $key => $date) {166 if (isset($hotline[$key])) {167 $dateHotlines[$date] = $hotline[$key];168 }169 }170 // save date phone value to redis171 $this->redis->del($hotlineKey);172 return $this->redis->hmset($hotlineKey, $dateHotlines);173 }174 }175 /**176 * hmset hotline key177 * 178 * @param string $key179 * @param array $dates 180 * @param array $hotline181 * @param integer $step 182 * 183 * @return bolean184 */185 public function hmsetKeyHotlineByHours ($hotlineKey, $dates, $hotlines = [], $step = 24) 186 {187 if (count($hotlines) > 1) {188 // remove array value null and sort key again189 $hotlines = array_values(array_filter($hotlines));190 // count hours with days191 $countHours = count($dates) * $step;192 $num = 0; 193 // check count 194 while($num < $countHours){195 // clone key by date196 $hotline[] = $hotlines[($num++ % count($hotlines))]; 197 }198 // chunk array with 24 elements 199 $chunkedArray = array_chunk($hotline, $step);200 // combine days with each array chunk201 $arrayCombineDates = array_combine($dates, $chunkedArray);202 $dateHotlines = [];203 foreach($arrayCombineDates as $key => $values) {204 foreach($values as $index => $value){205 $result[date("H", strtotime($index.":00"))] = $value;206 }207 208 $dateHotlines[$key] = json_encode($result);209 }210 // save date phone value to redis211 $this->redis->del($hotlineKey);212 213 return $this->redis->hmset($hotlineKey, $dateHotlines);214 } else {215 $this->redis->del($hotlineKey);216 }217 }218 /**219 * get hotline auto generate each day220 * 221 * @param string $type222 * @return string223 */224 public function getHotlineAutoWithDay($type = 'hotline')225 {226 $hotline = null;227 $key = $type . ':' . $this->_subdomain_id;228 if ($this->redis->exists($key)) {229 $hasKey = date('Y-m-d');230 $hotline = $this->redis->hGet($key, $hasKey);231 }232 return $hotline;233 }234 /**235 * get hotline auto generate each day236 * 237 * @param string $type238 * @return string239 */240 public function getHotlineAuto($type = 'hotline')241 {242 $hotline = null;243 $key = $type . ':' . $this->_subdomain_id;244 if ($this->redis->exists($key)) {245 $hasKey = date('Y-m-d');246 $hotline = $this->redis->hGet($key, $hasKey);247 $getKey = json_decode($hotline, true);248 $getHour = date('H');249 $hotline = $getKey[$getHour];250 }251 return $hotline;252 }253}...
_BW_NODE.php
Source:_BW_NODE.php
...21 protected $my_node_content = "default"; // non-markup22 protected $my_children;23 function __construct( $the_params_map = "default" ) {24 if ( $the_params_map !== "default" ) {25 if ( $the_params_map->hasKey( "my_handle" ) && $the_params_map->get( "my_handle" ) !== "default" ) {26 $this->my_handle = $the_params_map->get( "my_handle" );27 }28 if ( $the_params_map->hasKey( "my_name" ) && $the_params_map->get( "my_name" ) !== "default" ) {29 $this->my_name = $the_params_map->get( "my_name" );30 }31 if ( $the_params_map->hasKey( "my_title" ) && $the_params_map->get( "my_title" ) !== "default" ) {32 $this->my_title = $the_params_map->get( "my_title" );33 }34 if ( $the_params_map->hasKey( "my_type" ) && $the_params_map->get( "my_type" ) !== "default" ) {35 $this->my_type = $the_params_map->get( "my_type" );36 }37 if ( $the_params_map->hasKey( "my_parent" ) && $the_params_map->get( "my_parent" ) !== "default" ) {38 $this->my_parent = $the_params_map->get( "my_parent" );39 }40 if ( $the_params_map->hasKey( "my_left_sibling" ) && $the_params_map->get( "my_left_sibling" ) !== "append" ) {41 $this->my_left_sibling = $the_params_map->get( "my_left_sibling" );42 }43 if ( $the_params_map->hasKey( "my_meta" ) && $the_params_map->get( "my_meta" ) !== "default" ) {44 $this->my_meta = $the_params_map->get( "my_meta" );45 }46 if ( $the_params_map->hasKey( "my_namespace" ) && $the_params_map->get( "my_namespace" ) !== "default" ) {47 $this->my_namespace = $the_params_map->get( "my_namespace" );48 }49 if ( $the_params_map->hasKey( "my_context" ) && $the_params_map->get( "my_context" ) !== "default" ) {50 $this->my_context = $the_params_map->get( "my_context" );51 }52 if ( $the_params_map->hasKey( "my_template" ) && $the_params_map->get( "my_template" ) !== "default" ) {53 $this->my_template = $the_params_map->get( "my_template" );54 }55 if ( $the_params_map->hasKey( "my_class" ) && $the_params_map->get( "my_class" ) !== "default" ) {56 $this->my_class = $the_params_map->get( "my_class" );57 }58 if ( $the_params_map->hasKey( "my_factory" ) && $the_params_map->get( "my_factory" ) !== "default" ) {59 $this->my_factory = $the_params_map->get( "my_factory" );60 }61 if ( $the_params_map->hasKey( "my_source_file" ) && $the_params_map->get( "my_source_file" ) !== "default" ) {62 $this->my_source_file = $the_params_map->get( "my_source_file" );63 }64 if ( $the_params_map->hasKey( "my_source_folder" ) && $the_params_map->get( "my_source_folder" ) !== "default" ) {65 $this->my_source_folder = $the_params_map->get( "my_source_folder" );66 }67 if ( $the_params_map->hasKey( "my_node_opener" ) && $the_params_map->get( "my_node_opener" ) !== "##!-- /* Generic node */>" ) {68 $this->my_node_opener = $the_params_map->get( "my_node_opener" );69 }70 if ( $the_params_map->hasKey( "my_node_closer" ) && $the_params_map->get( "my_node_closer" ) !== "default" ) {71 $this->my_node_closer = $the_params_map->get( "my_node_closer" );72 }73 74 $this->my_node_content = new \Ds\Queue();75 if ( $the_params_map->hasKey( "my_node_content" ) && $the_params_map->get( "my_node_content" ) !== "default" ) {76 $this->my_node_content->push( $the_params_map->get( "my_node_content" ) );77 }78 $this->my_children = new \Ds\Map();79 }80 }81 public function get_my_node_opener() {82 return $this->my_node_opener;83 }84 public function get_my_node_closer() {85 return $this->my_node_closer;86 }87 public function get_my_node_content() {88 return $this->my_node_content;89 }...
hasKey
Using AI Code Generation
1$child = new ChildClass();2$child->hasKey('key');3$parent = new ParentClass();4$parent->hasKey('key');5$child = new ChildClass();6$child->hasKey('key');7$child = new ChildClass();8$child->hasKey('key');9$parent = new ParentClass();10$parent->hasKey('key');11$child = new ChildClass();12$child->hasKey('key');
hasKey
Using AI Code Generation
1$obj = new ChildClass();2$obj->hasKey('key1');3$obj = new ChildClass();4$obj->hasKey('key1');5$obj = new ChildClass();6$obj->hasKey('key1');
hasKey
Using AI Code Generation
1$obj = new Child();2$obj->hasKey(2);3$obj = new Child();4$obj->hasKey(2);5$obj = new Child();6$obj->hasKey(2);7$obj = new Child();8$obj->hasKey(2);9$obj = new Child();10$obj->hasKey(2);11$obj = new Child();12$obj->hasKey(2);13$obj = new Child();14$obj->hasKey(2);15$obj = new Child();16$obj->hasKey(2);17$obj = new Child();18$obj->hasKey(2);19$obj = new Child();20$obj->hasKey(2);21$obj = new Child();22$obj->hasKey(2);23$obj = new Child();24$obj->hasKey(2);25$obj = new Child();26$obj->hasKey(2);27$obj = new Child();28$obj->hasKey(2);29$obj = new Child();30$obj->hasKey(2);31$obj = new Child();32$obj->hasKey(2);33$obj = new Child();34$obj->hasKey(2);
hasKey
Using AI Code Generation
1echo $obj->hasKey('key1');2echo $obj->hasKey('key1');3echo $obj->hasKey('key1');4echo $obj->hasKey('key1');5echo $obj->hasKey('key1');6echo $obj->hasKey('key1');7echo $obj->hasKey('key1');8echo $obj->hasKey('key1');9echo $obj->hasKey('key1');10echo $obj->hasKey('key1');11echo $obj->hasKey('key1');12echo $obj->hasKey('key1');13echo $obj->hasKey('key1');14echo $obj->hasKey('key1');15echo $obj->hasKey('key1');16echo $obj->hasKey('key1');17echo $obj->hasKey('key1');18echo $obj->hasKey('key1');
hasKey
Using AI Code Generation
1$child = new Child();2if($child->hasKey('key1'))3{4 echo 'key1 exists';5}6{7 echo 'key1 does not exists';8}
hasKey
Using AI Code Generation
1$obj->hasKey('key1');2$obj->hasKey('key1');3The syntax of class_exists() function is:4class_exists(class_name, autoload)5The class_exists() function accepts two parameters:6if(!class_exists('XCache')){7 class XCache{8 public function hasKey($key){9 echo "Checking if key '$key' exists in cache";10 }11 }12}13$obj = new XCache();14$obj->hasKey('key1');15When to use class_exists() function?
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with hasKey on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!