檢查點數是不是足夠用，如果傳入 int 的話只會檢查總點數

如果傳入陣列則會每項檢查是否足夠或是使用者不擁有這個點數

@param array ...$points
@return bool
165495
public function notEnoughPointToUse(...$points)
    {
        $currentPoint = $this->currentPoint();
        /**
         * 檢查是不是有足夠的點數可以用
         *
         * 如果傳入值是 int，只需要比對總數是否足夠
         *
         * 如果傳入陣列，則需每個比對是否足夠，如果不夠，回應差多少
         */
        if (is_int($points[0]))
            return $currentPoint < $points[0];

        $currentPoint = $this->getCanUsePoints();
        $points = array_shift($points);
        $notEnoughPoint = collect($points)->map(function ($point, $key) use ($currentPoint) {

            $pointType = $currentPoint->where('name', $key)->first();

            //如果使用者沒有擁有這個點數
            if (is_null($pointType))
                return false;
//                return 0 - $pointType;
            //如果使用者這這個點數項目不夠
            else if ($pointType->number < $point)
                return false;
            //返回扣除後剩下幾點
            else
                return $pointType->number - $point;
        })->values()->all();


        return in_array(false ,$notEnoughPoint ,true);
    }
731012
public function addPoints(array $points)
    {
        $this->points = array_merge($this->points, $points);

        $endPoint = $this->points[count($this->points) - 1];
        $this->posX = $endPoint[0];
        $this->posY = $endPoint[1];
    }
595812
public function insert(array $sets)
    {
        if (count($sets)) {
            if (method_exists($this, 'insertRecordSets')) {
                $this->insertRecordSets($sets);
            }

            if (method_exists($this, 'beforeInsert')) {
                $this->beforeInsert($sets);
            }

            if (method_exists($this, 'getRecordOrdering')) {
                if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) {
                    $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table);
                }
            }

            if ($this->qb->table($this->table)->insert($sets)) {
                if (method_exists($this, 'afterInsert')) {
                    return $this->afterInsert();
                }

                return true;
            }
        }

        return false;
    }
374378
public function setValues($values=array()) {
		$count=$this->count();
		$isArray=true;
		if (\is_array($values) === false) {
			$values=\array_fill(0, $count, $values);
			$isArray=false;
		}
		if (JArray::dimension($values) == 1 && $isArray)
			$values=[ $values ];

		$count=\min(\sizeof($values), $count);

		for($i=0; $i < $count; $i++) {
			$row=$this->content[$i];
			$row->setValues($values[$i]);
		}
		return $this;
	}
810095
public boolean isOnBorder(Point<?> points) {
    boolean		result;
    Point<Integer>	locations;
    int		i;

    if (points.dimensions() != dimensions())
      throw new IllegalArgumentException(
        "Dimension mismatch: space=" + dimensions()
          + ", points=" + points.dimensions());

    if (!(points.getValue(0) instanceof Integer))
      locations = getLocations((Point<Object>) points);
    else
      locations = (Point<Integer>) points;

    result = false;
    for (i = 0; i < dimensions(); i++) {
      if (getDimension(i).isOnBorder(locations.getValue(i))) {
        result = true;
        break;
      }
    }

    return result;
  }
1094298
public function inserts(array $values): int
    {
        $params = [$this->name];
        foreach ($values as $name=>$pos) {
            $params[] = $pos[0];
            $params[] = $pos[1];
            $params[] = $name;
        }
        return intval($this->handle->rawCommand('geoadd', $params));
    }
790900
public function valid($fields = array())
    {
        if (empty($fields)) {
            $fields = array_diff($this->getFields(), array($this->getIndex()));
        }
        foreach ($fields as $field) {
            $value = $this->getFieldValue($field);
            if (!empty($value)) {
                return true;
            }
        }
        return false;
    }
180413
@JsonIgnore
    public void setPoints(int[] points) {
        this.points = new ArrayList<>();
        for (int i = 0; i < points.length; i++) {
            this.points.add(points[i]);
        }
    }
147335
public function validate(&$errors = []) {
		if (!isset($this->type)) {
			$errors[] = 'type';
		}

		if (!isset($this->sender['email'])) {
			$errors[] = 'sender[email]';
		}

		if (!isset($this->recipients) or count($this->recipients) == 0) {
			$errors[] = 'recipients';
		}

		if (count($errors) == 0) {
			return true;
		} else {
			return false;
		}
	}
259056
public function haveMultipleEndpoints() 
    {
        assert(is_array($this->_values[self::OPTION_ENDPOINT]));
        return count($this->_values[self::OPTION_ENDPOINT]) > 1;
    }
1054789
public function andX(array $expressions)
    {
        return function ($object) use ($expressions) {
            foreach ($expressions as $expression) {
                if (!$expression($object)) {
                    return false;
                }
            }

            return true;
        };
    }
160222
public function deleteMultiple($keys)
    {
        $failTimes = 0;
        foreach ($keys as $key) {
            if (!$this->delete($key)) {
                $failTimes++;
            }
        }

        return $failTimes == 0;
    }
188782
private function encodeLevels($points, $dists, $absMaxDist)
    {
        $encoded_levels = '';

        if ($this->forceEndpoints) {
            $encoded_levels .= $this->encodeNumber($this->numLevels - 1);
        } else {
            $encoded_levels .= $this->encodeNumber($this->numLevels - $this->computeLevel($absMaxDist) - 1);
        }
        for ($i = 1; $i < count($points) - 1; $i++) {
            if (isset($dists[$i])) {
                $encoded_levels .= $this->encodeNumber($this->numLevels - $this->computeLevel($dists[$i]) - 1);
            }
        }
        if ($this->forceEndpoints) {
            $encoded_levels .= $this->encodeNumber($this->numLevels - 1);
        } else {
            $encoded_levels .= $this->encodeNumber($this->numLevels - $this->computeLevel($absMaxDist) - 1);
        }
        return $encoded_levels;
    }
1154853
public function hasMany(array $events)
    {
        foreach ($events as $event) {
            if (!$this->has($event)) {
                return false;
            }
        }

        return true;
    }
1340011
private function readPoints($count)
    {
        $points = array();

        for ($i = 0; $i < $count; $i++) {
            $points[] = $this->point();
        }

        return $points;
    }
1159577
protected function setQueryLogItemsToPoint(Point $point)
    {
        // Skip if query log is disabled
        if($this->config->queryLogState !== true)
            return;

        $point->setQueryLog($this->queryLogStack);
        $this->queryLogStack = [];
    }
939838
public static function empty(...$values): bool
    {
        self::handleInvalidArguments($values);

        foreach ($values as $value) {
            if (empty($value) === false) {
                return false;
            }
        }

        return true;
    }