Add accumulator to the group

@param  string $group
@param  string $definition
@throws Exceptions\InvalidDefinition
496867
protected function addAccumulator($group, $definition) {
		$definition = trim($definition);
		
		if (! preg_match('/^([a-z]+)\s*\(\s*(.+)\s*\)$/i', $definition, $matches)) {
			throw new Exceptions\InvalidDefinition('Invalid definition: "' . $definition . '"');
		}
		
		$function = strtolower(trim($matches[1]));
		$property = trim($matches[2]);
		
		if (! in_array($function, static::$mongoAggregators, true)) {
			throw new Exceptions\InvalidDefinition('Invalid aggregate function: "' . $function . '"');
		}
		
		$this->_groupDefinition[$group] = ['$' . $function => '$' . $property];
	}
748985
public function addGroup(GroupInterface $group)
	{
		if ( ! $this->inGroup($group))
		{
			$this->groups()->attach($group);
			$this->invalidateUserGroupsCache();
			$this->invalidateMergedPermissionsCache();
		}

		return true;
	}
1221336
public function addGroup(GroupInterface $group): self
    {
        if (!$group instanceof Production) {
            throw new Exception('Group type not supported.');
        }
        $this->groups[] = $group;

        return $this;
    }
193530
public void addGroup(Group section) {
    if (section != null) {
      if (section.isAnyAgent()) {
        if (this.defaultSection == null) {
          this.defaultSection = section;
        } else {
          this.defaultSection.getAccessList().importAccess(section.getAccessList());
        }
      } else {
        Group exact = findExactSection(section);
        if (exact == null) {
          groups.add(section);
        } else {
          exact.getAccessList().importAccess(section.getAccessList());
        }
      }
    }
  }
694861
public function addRouteDefinition(RouteDefinition $definition): void
    {
        $name = $definition->getName();

        if (isset($this->routesByName[$name])) {
            throw new \InvalidArgumentException("Route with name '$name' already exists");
        }

        $routeId = \count($this->routeDefinitions);
        $segments = $definition->getSegments();

        $this->routeDefinitions[$routeId] = $definition->getDefinitionCache();
        $this->routesByName[$name] = $routeId;

        if ($definition->isStatic()) {
            $this->staticRoutes[implode('/', $segments)][] = $routeId;
            return;
        }

        foreach ($segments as $i => $segment) {
            $this->segmentValues[$i][$segment][$routeId] = $routeId;

            if (!isset($this->segmentCounts[$i])) {
                $this->segmentCounts[$i] = [];
            }
        }

        $this->segmentCounts[\count($segments)][$routeId] = $routeId;
    }
770406
public function initialise(cache_definition $definition) {
        if ($this->is_initialised()) {
            throw new coding_exception('This memcached instance has already been initialised.');
        }
        $this->definition = $definition;
        $this->isinitialised = true;
    }
506420
public function set(string $group, string $key, $value): ArrayCache
    {
        if ($group === "") {
            throw new \InvalidArgumentException(
                "invalid group provided; expecting a non empty string"
            );
        }

        if ($key === "") {
            throw new \InvalidArgumentException(
                "invalid key provided; expecting a non empty string"
            );
        }

        if ($value === null) {
            throw new \InvalidArgumentException(
                "invalid value provided; expecting anything but null"
            );
        }

        if (!isset($this->values[$group])) {
            $this->values[$group] = [];
        }

        $this->values[$group][$key] = $value;
        return $this;
    }
347758
function addToGroup($group)
    {
        $this->_api->doRequest("PUT", "{$group->getBaseApiPath()}/contacts/{$this->id}");               
        $this->_group_ids_set[$group->id] = true;        
    }
396616
private function registerGroupChange($custId, $groupIdOld, $groupIdNew)
    {
        $data = new EChangeGroup();
        $data->setCustomerRef($custId);
        $data->setGroupOld($groupIdOld);
        $data->setGroupNew($groupIdNew);
        $dateChanged = $this->hlpDate->getUtcNowForDb();
        $data->setDateChanged($dateChanged);
        $this->daoChangeGroup->create($data);
    }
158967
public function addGroup($group)
    {
        if (null === $this->groups) {
            $this->groups = [];
        }
        if (!in_array($group, $this->groups)) {
            $this->groups[] = $group;
        }

        return $this;
    }
1013308
public function addImplicitGroupName($group)
    {
        parent::addImplicitGroupName($group);

        /** @var Constraint[] $nestedConstraints */
        $nestedConstraints = $this->{$this->getCompositeOption()};

        foreach ($nestedConstraints as $constraint) {
            $constraint->addImplicitGroupName($group);
        }
    }
644232
public function add($value)
    {
        if (! $value instanceof SpecificationInterface) {
            throw new InvalidArgumentException(sprintf(
                '"%s" does not implement "%s"!',
                (is_object($value)) ? get_class($value) : $value,
                SpecificationInterface::class
            ));
        }

        return parent::add($value);
    }
814219
public function Add( $duration )
	{
		if ( ! $duration instanceof DurationValue )
		{
			throw new \InvalidArgumentException();
		}

		// $durationFactor = $duration->Value->invert ? -1 : 1;
		// $thisFactor = $this->Value->invert ? -1 : 1;

		// $thisSeconds = new DecimalValue( $this->Value->days * 86400 + $this->Value->h * 3600 + $this->Value->i * 60 + $this->Value->s );
		// $thisSeconds = $thisSeconds->Add( "0." . $this->Value->microseconds );
		// $thisSeconds = $thisSeconds->Mul( $thisFactor );
		// $durationSeconds = new DecimalValue( $duration->Value->days * 86400 + $duration->Value->h * 3600 + $duration->Value->i * 60 + $duration->Value->s );
		// $durationSeconds = $durationSeconds->Add( "0." . $duration->microseconds );
		// $durationSeconds = $thisSeconds->Mul( $durationFactor );

		$thisSeconds = $this->getTotalSeconds();
		$durationSeconds = $duration->getTotalSeconds();

		/**
		 * @var DecimalValue $interval
		 */
		$interval = $thisSeconds->Add( $durationSeconds );
		$hasValue = $interval->CompareTo( 0 ) != 0;
		$invert = 0 > $interval->CompareTo( 0 ) == -1;
		$interval = $interval->getAbs();

		$days = $interval->Div( 86400 )->getIntegerPart();
		$interval = $interval->Sub( $days * 86400 );
		$h = $interval->Div( 3600 )->getIntegerPart();
		$interval = $interval->Sub( $h * 3600 );
		$i = $interval->Div( 60 )->getIntegerPart();
		$interval->Sub( $i * 60 );
		$interval = $interval->Sub( $i * 60 );
		$s = $interval->getIntegerPart();
		$microseconds = $interval->getDecimalPart();

		$specString = "P%02sDT%02sH%02sM%02sS";
		$interval = sprintf( $specString, $days, $h, $i, $s );

		$di = new \DateInterval( $interval );
		$di->hasValue = $hasValue;
		$di->invert = $invert;
		$di->microseconds = $microseconds;
		$this->Value = $di;

		// if ( $hasValue )
		// {
		// 	$this->type =  XPATH20_DURATION_TYPE_DAYTIME;
        //
		// }

	}
971060
public function setGroupName($groupName)
    {
        $group = posix_getgrnam($groupName);
        if (! isset($group['gid'])) {
            throw new InvalidArgumentException(sprintf('"%s" is not a valid group name', $groupName));
        }

        $this->setGroupId($group['gid']);
    }
1128387
public function insertGroup(Group $group)
    {
        $q = $this->dbHandler->createInsertQuery();
        $q->insertInto(
            $this->dbHandler->quoteTable('ezcontentclassgroup')
        )->set(
            $this->dbHandler->quoteColumn('id'),
            $this->dbHandler->getAutoIncrementValue('ezcontentclassgroup', 'id')
        )->set(
            $this->dbHandler->quoteColumn('created'),
            $q->bindValue($group->created, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('creator_id'),
            $q->bindValue($group->creatorId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('modified'),
            $q->bindValue($group->modified, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('modifier_id'),
            $q->bindValue($group->modifierId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('name'),
            $q->bindValue($group->identifier)
        );
        $q->prepare()->execute();

        return $this->dbHandler->lastInsertId(
            $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id')
        );
    }
84770
public static function accumulatorStart( $val, $group = false, $label = false, $data = null  )
    {
        // allow 3rd party code to leave in perf. measuring hooks with minimal speed loss
        if ( !self::$activated )
            return false;

        $startTime = microtime( true );
        if ( eZPerfLoggerDebug::isDebugEnabled() )
        {
            eZDebug::accumulatorStart( $val, $group, $label );
        }
        if ( !isset( self::$timeAccumulatorList[$val] ) )
        {
            self::$timeAccumulatorList[$val] = array( 'group' => $group, 'data' => array(), 'time' => 0, 'maxtime' => 0 );
        }
        self::$timeAccumulatorList[$val]['temp_time'] = $startTime;
        if ( $data !== null )
        {
            self::$timeAccumulatorList[$val]['data'][] = $data;
        }
    }
657639
public function addGroupings( $groupings )
	{
		if( !is_array( $groupings ) )
			throw new InvalidArgumentException( 'An Array should be given.' );
		foreach( $groupings as $grouping )
			$this->addGrouping( $grouping );
	}