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


PHP Core::equals方法代码示例

本文整理汇总了PHP中Core::equals方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::equals方法的具体用法?PHP Core::equals怎么用?PHP Core::equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


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

示例1: assert_read

 /**
  * @param object $object
  * @param array  $attrs
  *
  * @return Dev_Unit_Assert_Iterating_Bundle
  */
 public function assert_read($object, $attrs)
 {
     foreach ($object as $k => $v) {
         if (!isset($attrs[$k])) {
             throw new Dev_Unit_FailureException("failed: additional value in iterator for key '{$k}'");
         }
         if (!Core::equals($v, $attrs[$k])) {
             throw new Dev_Unit_FailureException(sprintf("failed: unexpected value for key '{$k}': %s != %s", $this->stringify($v), $this->stringify($attrs[$k])));
         }
     }
     return $this;
 }
开发者ID:techart,项目名称:tao,代码行数:18,代码来源:Iterating.php

示例2: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     if (!$to instanceof self) {
         return false;
     }
     if ($this->parent && !Core::equals($this->parent, $to->parent)) {
         return false;
     }
     foreach ($this->attrs as $k => $v) {
         if (!Core::equals($v, $to[$k])) {
             return false;
         }
     }
     return true;
 }
开发者ID:techart,项目名称:tao,代码行数:20,代码来源:WS.php

示例3: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     return $to instanceof self && Core::equals($this->values, $to->values) && Core::equals($this->parent, $to->parent);
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:Log.php

示例4: equals

 /**
  * Сравнивает две переменные произвольного типа
  *
  * @param  $a
  * @param  $b
  *
  * @return boolean
  */
 public static function equals($a, $b)
 {
     if ($a instanceof Core_EqualityInterface) {
         return $a->equals($b);
     }
     if ($b instanceof Core_EqualityInterface) {
         return $b->equals($a);
     }
     if ($a instanceof stdClass && $b instanceof stdClass) {
         $a = (array) clone $a;
         $b = (array) clone $b;
     }
     if (is_array($a) && is_array($b) || $a instanceof ArrayObject && $b instanceof ArrayObject) {
         if (count($a) != count($b)) {
             return false;
         }
         foreach ($a as $k => $v) {
             if (isset($a[$k]) && !isset($b[$k]) || !Core::equals($v, $b[$k])) {
                 return false;
             }
         }
         return true;
     }
     return $a === $b;
 }
开发者ID:techart,项目名称:tao,代码行数:33,代码来源:Core.php

示例5: process_context

 protected function process_context($e, $ldata)
 {
     switch (true) {
         case isset($ldata['context']):
             if ($e->is_with_context() && !Core::equals($ldata['context'], $e->get_context())) {
                 return false;
             }
             if (!$e->is_with_context()) {
                 return false;
             }
             break;
         case isset($ldata['subscriber']):
             if ($e->is_with_context() && !$ldata['subscriber']->filter_by_context($e->get_context(), $e)) {
                 return false;
             }
             break;
         case $e->is_with_context():
             return false;
         default:
             if (!$e->is_with_context() && !is_null($ldata['context'])) {
                 return false;
             }
     }
     return true;
 }
开发者ID:techart,项目名称:tao,代码行数:25,代码来源:Events.php

示例6: equals

 public function equals($with)
 {
     if (!$with instanceof Data_Object || !Core::equals($p = $this->get_properties(), $with->get_properties())) {
         return false;
     }
     foreach ($p as $v) {
         if (!Core::equals($this->{$v}, $with->{$v})) {
             return false;
         }
     }
     return true;
 }
开发者ID:techart,项目名称:tao,代码行数:12,代码来源:Data.php

示例7: assert_same

 /**
  * @param        $a
  * @param        $b
  * @param string $message
  *
  * @return Dev_Unit_TestCase
  */
 protected function assert_same($a, $b, $message = null)
 {
     $a_replace = str_replace(' ', '', str_replace("\n", '', $a));
     $b_replace = str_replace(' ', '', str_replace("\n", '', $b));
     if (!Core::equals($a_replace, $b_replace)) {
         throw new Dev_Unit_FailureException($message ? $message : sprintf('failed: %s !~ %s', $this->stringify($a), $this->stringify($b)));
     }
     return $this;
 }
开发者ID:techart,项目名称:tao,代码行数:16,代码来源:Unit.php

示例8: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     return get_class($this) == get_class($to) && Core::equals($this->status, $to->status) && parent::equals($to);
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:HTTP.php

示例9: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     return $to instanceof self && Core::equals($this->as_array(), $to->as_array());
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:AdWords.php

示例10: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     $r = $to instanceof self && Core::equals($this->head, $to->head);
     $this_body = $this->body instanceof IO_Stream_AbstractStream || $this->body instanceof IO_FS_File ? $this->body->load() : $this->body;
     $to_body = $to->body instanceof IO_Stream_AbstractStream || $to->body instanceof IO_FS_File ? $to->body->load() : $to->body;
     return $r && Core::equals($this_body, $to_body);
 }
开发者ID:techart,项目名称:tao,代码行数:12,代码来源:Message.php

示例11: assert_write

 /**
  * @param object $object
  * @param array  $attrs
  *
  * @return Dev_Unit_Assert_Indexing_Bundle
  */
 public function assert_write($object, array $attrs)
 {
     foreach ($attrs as $k => $v) {
         $this->set_trap();
         try {
             $object[$k] = $v;
             if (!Core::equals($object[$k], $v)) {
                 throw new Dev_Unit_FailureException("failed: can't change Object[{$k}]");
             }
         } catch (Core_MissingIndexedPropertyException $e) {
             $this->trap($e);
         } catch (Core_ReadOnlyIndexedPropertyException $e) {
             $this->trap($e);
         } catch (Core_ReadOnlyObjectException $e) {
             $this->trap($e);
         }
         if ($this->is_catch_prey()) {
             throw new Dev_Unit_FailureException("failed: can't write Object[{$k}]");
         }
     }
     return $this;
 }
开发者ID:techart,项目名称:tao,代码行数:28,代码来源:Indexing.php

示例12: assert_write

 /**
  * @param object $object
  * @param array  $attrs
  *
  * @return Dev_Unit_Assert_Accessing_Bundle
  */
 public function assert_write($object, array $attrs)
 {
     foreach ($attrs as $k => $v) {
         $this->set_trap();
         try {
             $object->{$k} = $v;
             if (!Core::equals($object->{$k}, $v)) {
                 throw new Dev_Unit_FailureException(sprintf("failed: can't change Object->{$k}: %s != %s", $this->stringify($v), $this->stringify($object->{$k})));
             }
         } catch (Core_MissingPropertyException $e) {
             $this->trap($e);
         } catch (Core_ReadOnlyPropertyException $e) {
             $this->trap($e);
         } catch (Core_ReadOnlyObjectException $e) {
             $this->trap($e);
         }
         if ($this->is_catch_prey()) {
             throw new Dev_Unit_FailureException("failed: can't write Object->{$k}");
         }
     }
     return $this;
 }
开发者ID:techart,项目名称:tao,代码行数:28,代码来源:Accessing.php

示例13: equals

 /**
  * @param  $to
  *
  * @return boolean
  */
 public function equals($to)
 {
     return get_class($this) === get_class($to) && $this->name == $to->name && $this->http_mask == $to->http_mask && Core::equals($this->path, $to->path) && Core::equals($this->formats, $to->formats);
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:REST.php


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