| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- /*
- * This file is part of the overtrue/wechat.
- *
- * (c) overtrue <i@overtrue.me>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace ByteDance\Kernel\Clauses;
- /**
- * Class Clause.
- *
- * @author mingyoung <mingyoungcheung@gmail.com>
- */
- class Clause
- {
- /**
- * @var array
- */
- protected $clauses = [
- 'where' => [],
- ];
- /**
- * @param mixed ...$args
- *
- * @return $this
- */
- public function where(...$args)
- {
- array_push($this->clauses['where'], $args);
- return $this;
- }
- /**
- * @param mixed $payload
- *
- * @return bool
- */
- public function intercepted($payload)
- {
- return (bool) $this->interceptWhereClause($payload);
- }
- /**
- * @param mixed $payload
- *
- * @return bool
- */
- protected function interceptWhereClause($payload)
- {
- foreach ($this->clauses['where'] as $item) {
- list($key, $value) = $item;
- if (isset($payload[$key]) && $payload[$key] !== $value) {
- return true;
- }
- }
- }
- }
|