Порядковый номер
@param int $new Новое порядковое значение
@return int
515507
function order($new = null)
    {
        if (isset($new) && ($this->_attributes['order'] != $new)){
            $this->change('order', (int)$new);
        }
        return $this->_attributes['order'];
    }
1189638
public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var static $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        // if no id, then it has not been save and can be returned
        if (empty($new->containerId)) {
            return $new;
        }

        $new->containerId = null;

        return $new;
    }
200397
protected function getUpdateId(): int
    {
        if (!$this->updateId) {
            $data = $this->browse("DirectChildren");
            $this->updateId = $data["UpdateID"];
        }
        return $this->updateId;
    }
104415
public function actionCreateAll(): int
    {
        $tables = $this->removeExcludedTables($this->db->schema->getTableNames());

        if (!$tables) {
            $this->stdout(' > Your database does not contain any tables yet.', Console::FG_YELLOW);

            return ExitCode::OK;
        }

        if ($this->confirm(' > Are you sure you want to generate ' . count($tables) . ' migrations?')) {
            return $this->actionCreate(implode(',', $tables));
        }

        $this->stdout(" Operation cancelled by user.\n\n", Console::FG_YELLOW);

        return ExitCode::OK;
    }
296068
public function calculate(string $old, string $new): array
    {
        $olds = \preg_split('//uS', $old, -1, \PREG_SPLIT_NO_EMPTY);
        $news = \preg_split('//uS', $new, -1, \PREG_SPLIT_NO_EMPTY);

        // calculate edit distance matrix
        $dist = $this->calculateDistance($olds, $news);

        // calculate edit progresses
        $progresses = $this->calculateProgresses($olds, $news, $dist);

        return [
            // (int) Levenshtein distance
            'distance' => $dist[\count($olds)][\count($news)],
            // (null|array) edit progresses
            'progresses' => $progresses,
        ];
    }
912470
protected function getRealLifetime($lifetime): int
    {
        if (null === $lifetime) {
            $lifetime = $this->defaultLifetime;
        }
        if (0 === $lifetime || $lifetime > $this->maximumLifetime) {
            $lifetime = $this->maximumLifetime;
        }

        return (int)$lifetime;
    }
511817
public function createNewRecord($data) {

        $email = new $this->model;

        $email->email_type_id = $data['email_type_id'];
        $email->title         = $data['title'];
        $email->description   = $data['description'];
        $email->comments      = $data['comments'];
        $email->created_at    = $data['created_at'];
        $email->created_by    = $data['created_by'];
        $email->updated_at    = $data['updated_at'];
        $email->updated_by    = $data['updated_by'];
        $email->locked_at     = null;
        $email->locked_by     = null;

        if ($email->save()) {

            // Return the new ID
            return $email->id;
        }

        return false;
    }
360451
public function getEngine($new = false)
    {
        if (!$this->engine || $new) {
            $this->engine = new \Mustache_Engine($this->config->get('options', []));
        }

        return $this->engine;
    }
379274
public function call(): int
    {
        $count = 0;

        while (!$this->queue->isEmpty() && (0 === $this->maxDepth || $count < $this->maxDepth)) {
            list($callback, $args) = $this->queue->shift();
            ++$count;

            if (empty($args)) {
                $callback();
            } else {
                call_user_func_array($callback, $args);
            }
        }

        return $count;
    }
615685
public function incrementColumn($type, $increment = 1)
    {
        if ($type === 'new') {
            return $this->incrementColumnInNew($increment);
        }

        return $this->incrementColumnInOld($increment);
    }
273842
function name($new = null, $choose_unique = false)
    {
        if (!isset($new) && $choose_unique) $new = $this->_attributes['name'];
        if (isset($new) && ($this->_attributes['name'] != $new || $choose_unique)){
            // Фильтр имени
            $new = preg_replace('/\s/ui','_',$new);
            $this->change('name', $new);
            $this->change('uri', $this->parent().'/'.$new);
            $this->_auto_naming = $choose_unique;
        }
        return $this->_attributes['name'];
    }
994656
public function deleteById($id) : int
    {
        $sql = 'DELETE FROM `' . $this->table . '` WHERE ';

        // Assign ids
        if (is_array($id)) {
            $i = 0;
            foreach ($id as $_id) {
                if ($i === 0) {
                    $sql .= ' id=:id' . $i;
                } else {
                    $sql .= ' OR id=:id' . $i;
                }
                $i++;
            }
            $query = $this->pdo->prepare($sql);
            for ($j = 0; $j < 0; $j++) {
                $query->bindParam(':id' . $j, $id[$j]);
            }
        } else {
            $sql .= 'id=:id';
            $query = $this->pdo->prepare($sql);
            $query->bindParam(':id', $id);
        }

        $query->execute();

        return $query->rowCount();
    }
515537
public function increment(string $field, int $num) : int
        {
                return intval($this->_redis->hincrby($this->_key, $field, $num));
        }
744059
public function intVal(): int
    {
        if (!isset($this->_intNum)) {
            $num = gmp_init($this->_num, 10);
            if (gmp_cmp($num, $this->_intMaxGmp()) > 0) {
                throw new \RuntimeException("Integer overflow.");
            }
            if (gmp_cmp($num, $this->_intMinGmp()) < 0) {
                throw new \RuntimeException("Integer underflow.");
            }
            $this->_intNum = gmp_intval($num);
        }
        return $this->_intNum;
    }
538126
public function save(): int
    {
        if (!$this->isLoaded()) {
            $this->dispatch('create', new DocumentEvent($this));

            //Performing creation
            $result = $this->odm->collection(static::class)->insertOne($this->packValue(false));
            $this->setField('_id', $result->getInsertedId());
            $this->flushChanges();
            //Done with creation

            $this->dispatch('created', new DocumentEvent($this));

            return self::CREATED;
        }

        if ($this->isSolid() || $this->hasChanges()) {
            $this->dispatch('update', new DocumentEvent($this));

            //Performing an update
            $this->odm->collection(static::class)->updateOne(
                ['_id' => $this->primaryKey()],
                $this->buildAtomics()
            );
            $this->flushChanges();
            //Done with update

            $this->dispatch('updated', new DocumentEvent($this));

            return self::UPDATED;
        }

        return self::UNCHANGED;
    }
619158
public function getNbResults(): int
    {
        if ($this->nbResults !== null) {
            return $this->nbResults;
        }

        return $this->nbResults = $this->notificationService->getNotificationCount();
    }
749943
public function getInitialAction($id)
    {
        if (!is_numeric($id)) {
            $errMsg = 'Аргумент должен быть числом';
            throw new ArgumentNotNumericException($errMsg);
        }
        $id = (integer)$id;

        $initialActions = $this->getInitialActions();
        foreach ($initialActions as $actionDescriptor) {
            if ($id === $actionDescriptor->getId()) {
                return $actionDescriptor;
            }
        }

        return null;
    }