Возвращает последнюю примененную миграцию
@return bool
355321
protected function getLastMigration()
    {
        $lastMigrationTime = $this->getLastMigrationTime();
        if (empty($lastMigrationTime))
            return false;

        foreach (glob($this->getMigrationsPath() . DS . sprintf(self::CLASS_NAME_PATTERN, $lastMigrationTime, '*') . '.php') as $fileName) {
            $className = self::MIGRATIONS_NAMESPACE . '\\' . pathinfo($fileName, PATHINFO_FILENAME);
            $migration = new $className;
            break;
        }

        return $migration;
    }
1369077
protected function load()
    {
        $id = $this->getId();
        $values = $this->getStore()->fetch($id);

        if ($values === false) {
            return false;
        }

        // metadata
        $metadata = $values[self::METADATA_NAMESPACE];
        $this->firstTrace = $metadata['firstTrace'];
        $this->lastTrace = $metadata['lastTrace'];
        $this->regenerationTrace = $metadata['regenerationTrace'];
        $this->requestsCount = $metadata['requestsCount'];
        $this->fingerprint = $metadata['fingerprint'];

        // values
        $this->values = $values;

        return true;
    }
654443
public function save(): bool
	{
		$success = true;

		if(!$this->isPersisted)
		{
			// This is a new record so we need to insert it into the database.

			$this->insertRecord($this->builder());

			$this->isPersisted = true;
		}
		elseif($this->isModified())
		{
			// This record exists and is modified so all we have to do is update it.

			$success = $this->updateRecord($this->builder());
		}

		if($success)
		{
			// Sync up if save was successful

			$this->synchronize();
		}

		return $success;
	}
501388
public function isAccessible()
    {
        $root = $this->getRootParagraph();

        if ( ! empty( $root->allAccess ) )
        {
            return true;
        }

        $user = $this->getAuthenticatedUser();

        if ( empty( $user ) )
        {
            return ! empty( $root->accessUsers ) && in_array( '', $root->accessUsers )
                || ! empty( $root->accessGroups ) && in_array( '', $root->accessGroups );
        }

        return ! empty( $root->accessUsers ) && in_array( $user->id, $root->accessUsers )
            || ! empty( $root->accessGroups ) && in_array( $user->groupId, $root->accessGroups )
            || $this->getServiceLocator()
                    ->get( 'Grid\User\Model\Permissions\Model' )
                    ->isAllowed( $root, 'view' );
    }
741294
public function verify()
	{
		// TODO check structure
		if($this->type != SocialRecord::TYPE_PLATFORM && $this->type != SocialRecord::TYPE_USER && $this->type != SocialRecord::TYPE_PAGE)
			throw new SocialRecordFormatException('invalid type value [' . $this->type . ']');
		
		if(!GID::isValid($this->globalID))
			throw new SocialRecordFormatException('invalid globalID value');
			
		if(!GID::isValid($this->platformGID))
			throw new SocialRecordFormatException('invalid platformGID value');
		
		if(!GID::verifyGID($this->personalPublicKey, $this->salt, $this->globalID))
			throw new SocialRecordFormatException('invalid globalID value');
		
		if(!XSDDateTime::isValid($this->datetime))
			throw new SocialRecordFormatException('invalid date value [' . $this->datetime . ']');
		
		/*if($this->)
			throw new SocialRecordFormatException('invalid value');
		*/
		
		return true;
	}
818604
public function getDigest()
    {
        return isset($this->arreglo[$this->config['tipos'][$this->tipo]]['Signature']['SignedInfo']['Reference']['DigestValue']) ? $this->arreglo[$this->config['tipos'][$this->tipo]]['Signature']['SignedInfo']['Reference']['DigestValue'] : false;
    }
757611
public function isOutdated()
    {
        if ($this->Fetched) {
            $fetched = new \DateTime($this->Fetched);
            $now = new \DateTime("now");
            $diff = $now->getTimestamp() - $fetched->getTimestamp();
            if ($diff > Client::getRefreshRate()) {
                return true;
            }
            return false;
        }

        return true;
    }
788230
public function getRemote_version()
	{
		$params = array(
			'body' => array(
				'action' => 'version',
				'license_user' => $this->license_user,
				'license_key' => $this->license_key,
			),
		);
		$request = wp_remote_post ($this->update_path, $params );
		if ( !is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
			return unserialize( $request['body'] );
		}
		return false;
	}
134420
public function save()
    {
        $saved = true;

        foreach ($this->_relationsToSave as $model) {
            $model->{$this->relPrimaryKey} = $this->owner->primaryKey;

            if (!$model->save()) {
                $this->owner->addErrors($model->getErrors());

                $saved = false;
            }
        }

        return $saved;
    }
54244
public function canEmbed():bool
    {
        return (
            !Craft::$app->getRequest()->getIsAjax() &&
            !Craft::$app->getRequest()->getIsConsoleRequest() &&
            !Craft::$app->getRequest()->getIsCpRequest() &&
            !Craft::$app->getRequest()->getIsLivePreview() &&
            !Craft::$app->getUser()->getIsGuest() &&
            (Craft::$app->getUser()->getIsAdmin() || Craft::$app->getUser()->checkPermission('accessCp'))
        );
    }
745523
private function get_iri()
    {
        if (!$this->is_valid())
        {
            return false;
        }

        $iri = '';
        if ($this->scheme !== null)
        {
            $iri .= $this->scheme . ':';
        }
        if (($iauthority = $this->get_iauthority()) !== null)
        {
            $iri .= '//' . $iauthority;
        }
        $iri .= $this->ipath;
        if ($this->iquery !== null)
        {
            $iri .= '?' . $this->iquery;
        }
        if ($this->ifragment !== null)
        {
            $iri .= '#' . $this->ifragment;
        }

        return $iri;
    }
40511
public function save()
	{
		if ( ! $this->is_loaded() ) return false;

		$this->fill_defaults();

		$error = null;

		$id = wp_insert_post( $this->attributes, $error );

		if ( ! empty( $id ) ) {

			$this->attributes['ID'] = $id;

			$this->save_meta_all();

		}

		return $error === false ? true : $error;
	}
270365
protected function refresh_info()
    {

        $this->pid   = (int)getmypid();
        $this->gid   = (int)getmygid();
        $this->inode = (int)getmyinode();
        $this->uid   = (int)getmyuid();
        $this->user  = (string)get_current_user();
        $this->uname = posix_uname();

        return true;
    }
79402
public function usesBinaryData()
    {
        $isBinary = false;
        if ($this->getInnerIterator() instanceof UsesBinaryDataInterface) {
            $isBinary = $this->getInnerIterator()->usesBinaryData();
        }
        return $isBinary;
    }
1197515
public function reload(): bool
	{
		if($this->isPersisted)
		{
			$model = static::get($this->getPrimaryKeyValue());

			if($model !== false)
			{
				$this->original = $this->columns = $model->getRawColumnValues();

				$this->related = $model->getRelated();

				return true;
			}
		}

		return false;
	}
592720
public function hasUniqueSlug()
    {
        $hash = $this->slugWorkingRecord->{$this->slugDbField} ?: $this->encrypt();
        $list = $this->slugWorkingRecord->get()->filter($this->slugDbField, $hash);

        if($this->slugWorkingRecord->ID) {
            $list = $list->exclude('ID', $this->slugWorkingRecord->ID);
        }
        else {
            $list = $list->exclude('ID', 0);
        }

        return !($list->exists());
    }
195251
public function aggregated()
    {
        if ($this->getEntityState() & AnDomain::STATE_NEW) {
            return false;
        }

        if ($this->getRowData('bundle_key') == null) {
            return false;
        }

        return count($this->getIds()) > 1;
    }