Whether the product is a bundled item and its ID is in a list of allowed IDs
@param array $condition
@param array $data
@return boolean
191975
public function itemId(array $condition, array $data)
    {
        if (!isset($data['product_id']) || !isset($data['bundle'])) {
            return false;
        }

        if (!is_array($data['bundle'])) {
            $data['bundle'] = explode(',', (string) $data['bundle']);
        }

        return $this->compare($data['bundle'], $condition['value'], $condition['operator']);
    }
1161762
private function doConditionsApply(array $conditions) : bool
    {
        $conditionRunner = new Condition($this->io, $this->repository);
        foreach ($conditions as $config) {
            if (!$conditionRunner->doesConditionApply($config)) {
                return false;
            }
        }
        return true;
    }
714860
public function isContainsProduct($productId, $combinationId = null)
    {
        if (Yii::$app->user->isGuest) {
            if (!empty(Yii::$app->session[self::SESSION_KEY])) {
                $sessionProducts = Yii::$app->session[self::SESSION_KEY];

                foreach ($sessionProducts as $item) {
                    $condition = (empty($combinationId))
                        ? (ArrayHelper::getValue($item, 'id') == $productId)
                        : (ArrayHelper::getValue($item, 'id') == $productId && ArrayHelper::getValue($item, 'combinationId') == $combinationId);

                    if($condition) {
                        return $condition;
                    }
                }
            }
        } else {
            /** @var Order $order */
            $order = Order::find()
                ->where(['user_id' => Yii::$app->user->id, 'status' => OrderStatus::STATUS_INCOMPLETE])
                ->one();

            if (!empty($order)) {
                $condition = (empty($combinationId))
                    ? ['order_id' => $order->id, 'product_id' => $productId]
                    : ['order_id' => $order->id, 'product_id' => $productId, 'combination_id' => $combinationId];

                $product = OrderProduct::find()
                    ->where($condition)
                    ->one();

                return (!empty($product));
            }
        }

        return false;
    }
860340
protected function _isItemActive(array $item): bool
    {
        if (empty($item['url'])) {
            return false;
        }
        $current = $this->_currentUrl;
        if (!empty($item['url']['plugin']) && $item['url']['plugin'] != $current['plugin']) {
            return false;
        }
        if ($item['url']['controller'] == $current['controller'] && $item['url']['action'] == $current['action']) {
            $this->_controllerActive = $current['controller'];
            $this->_actionActive = $item['url']['action'];

            return true;
        }
        if (!empty($this->_actionActive) && $item['url']['controller'] == $current['controller']) {
            $this->_controllerActive = $current['controller'];

            return true;
        }

        return false;
    }
979377
public function filterOne(array $condition)
	{
		foreach ($this->data as $item) {
			foreach ($condition as $key => $value) {
				if ($item[$key] == $value) {
					$this->setData([$item]);

					return $this;
				}
			}
		}

		$this->setData([]);

		return $this;
	}
357387
public function filterRow(array $condition)
	{
		$this->onBeforeFilter($this->data_source);
		$this->onAfterFilter($this->data_source);

		return $this->data_source->filterOne($condition)->getData();
	}
471645
public function countryCode(array $condition, array $data, $key)
    {
        // Check form fields
        if (!empty($data['data']['address']['country'])) {
            $country = $data['data']['address']['country'];
            return $this->compare($country, $condition['value'], $condition['operator']);
        }

        if (empty($data['data']['order'][$key])) {
            return false;
        }

        $address = $this->address->get($data['data']['order'][$key]);

        if (empty($address['country'])) {
            return false;
        }

        return $this->compare($address['country'], $condition['value'], $condition['operator']);
    }
527265
public function deviceApplyId(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_DEVICE_APPLY_ID_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['data'] : false;
    }
764369
private function isMulti($item)
    {
        if ( ! is_array($item)) return false;

        return is_array(head($item)) || head($item) instanceof Buyable;
    }
596845
public function import(array $data)
    {
        $response = $this->client->post("{$this->uriImport}product/", [
            'json' => $data,
            'query' => [
                'key' => $this->config['data']['key'],
            ],
        ]);

        $response = json_decode($response->getBody(), true);

        if (isset($response['affected']) && $response['affected'] > 0) {
            return true;
        }

        return false;
    }
600065
public function filter($condition)
    {
        $items = $this->find()->where($condition)->all();
        $this->_filter = $this->_getTreeNodesIds($items);
    }
431975
public function filterHashCondition(array $data, $condition)
    {
        foreach ($condition as $column => $value) {
            if (is_array($value)) {
                // IN condition
                $data = $this->filterInCondition($data, 'IN', [$column, $value]);
            } else {
                $data = array_filter($data, function ($row) use ($column, $value) {
                    if ($value instanceof \Closure) {
                        return call_user_func($value, $row[$column]);
                    }

                    return $row[$column] == $value;
                });
            }
        }

        return $data;
    }
811522
public function setCondition(array $condition)
    {
        if (!isset($condition['function'])) {
            return false;
        }

        $this->conditional_function = $condition['function'];

        if (isset($condition['parameters'])) {
            $this->conditional_parameters = (array) $condition['parameters'];
        }

        if (isset($condition['inverse'])) {
            $this->conditional_inverse = (boolean) $condition['inverse'];
        }
    }
1063048
protected static function _isSimpleSequentialArray(array $data)
	{
		foreach ($data as $key => $value) {
			if (is_string($key) || is_array($value)) {
				return false;
			}
		}
		return true;
	}
813523
public function add(array $data)
    {
        $result = array();
        $this->hook->attach('wishlist.add.product.before', $data, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if ($this->wishlist->exists($data)) {
            return $this->getResultErrorExists($data);
        }

        if ($this->wishlist->exceedsLimit($data['user_id'], $data['store_id'])) {
            return $this->getResultErrorExceeds($data);
        }

        $data['wishlist_id'] = $this->wishlist->add($data);

        if (empty($data['wishlist_id'])) {
            return $this->getResultError();
        }

        $result = $this->getResultAdded($data);
        $this->hook->attach('wishlist.add.product.after', $data, $result, $this);
        return (array) $result;
    }
74298
protected function callHandler(array $condition, array $data)
    {
        try {
            $handlers = $this->getHandlers();
            return Handler::call($handlers, $condition['id'], 'process', array($condition, $data, $this));
        } catch (Exception $ex) {
            return false;
        }
    }
787961
public function hasDataPackageKey($dataKey, $packageName)
    {
        if (isset($this->data[$dataKey]) && is_array($this->data[$dataKey])) {
            $packageName = strtolower($packageName);
            foreach (array_keys($this->data[$dataKey]) as $k) {
                if (strtolower($k) === $packageName) {
                    return true;
                }
            }
        }
        return false;
    }