Collects defined object properties for a given version into an array

@param  mixed $version
@return array
422570
public function asVersion($version) {
        $result = array();

        foreach (get_object_vars($this) as $property => $value) {
            //
            // skip properties that start with an underscore to allow
            // storing information that isn't included in statement
            // structure etc. (see Attachment.content for example)
            //
            if (strpos($property, '_') === 0) {
                continue;
            }

            if ($value instanceof VersionableInterface) {
                $value = $value->asVersion($version);
            }
            elseif (is_array($value) && !empty($value)) {
                $tmp_value = array();
                foreach ($value as $element) {
                    if ($element instanceof VersionableInterface) {
                        array_push($tmp_value, $element->asVersion($version));
                    }
                    else {
                        array_push($tmp_value, $element);
                    }
                }
                $value = $tmp_value;
            }

            if (isset($value) && (!is_array($value) || !empty($value))) {
                $result[$property] = $value;
            }
        }

        if (method_exists($this, '_asVersion')) {
            $this->_asVersion($result, $version);
        }

        return $result;
    }
718647
private static function objectProperties($object): array
    {
        if ($object instanceof Serializable) {
            return ['$' => $object->serialize()];
        }

        $class = get_class($object);
        $properties = [];

        do {
            try {
                $properties += Closure::bind(function () use ($object) {
                    return get_object_vars($object);
                }, null, $class)->__invoke();
            } catch (Throwable $e) {
                return get_object_vars($object);
            }
        } while ($class = get_parent_class($class));

        return method_exists($object, '__sleep')
            ? array_intersect_key($properties, array_flip($object->__sleep()))
            : $properties;
    }
1107428
protected function extractObjectProperties($object): array
    {
        $properties = [];

        $reflection = new \ReflectionObject($object);

        // obtain public, protected and private properties of the class itself:

        foreach ($reflection->getProperties() as $property) {
            if ($property->isStatic()) {
                continue; // omit static properties
            }

            $property->setAccessible(true);

            $properties["\${$property->name}"] = $property->getValue($object);
        }

        // obtain any inherited private properties from parent classes:

        while ($reflection = $reflection->getParentClass()) {
            foreach ($reflection->getProperties(\ReflectionProperty::IS_PRIVATE) as $property) {
                $property->setAccessible(true);

                $properties["{$reflection->name}::\${$property->name}"] = $property->getValue($object);
            }
        }

        return $properties;
    }
697013
public function extract($object)
    {
        $data = [
            'revision_id' => $object->getRevision()->getId(),
            'name' => $object->getName(),
            'type' => $object->getType(),
            'ordering' => $object->getOrdering(),
            'include_pattern' => $object->getIncludePattern(),
            'exclude_pattern' => $object->getExcludePattern(),
        ];
        if ($object->getId()) {
            $data['id'] = $object->getId();
        }
        return $data;
    }
847299
public static function getProperties(
        ?object $object,
        ?string $classOverride = null,
        ?int $propertyType = null
    ): array {
        $reflectionClass = self::getReflectionClass($object, $classOverride);
        $properties = [];
        $reflectionProperties = $reflectionClass->getProperties($propertyType);
        foreach ($reflectionProperties as $property) {
            $property->setAccessible(true);
            $properties[$property->getName()] = $property->getValue($object);
        }
        return $properties;
    }
1351972
public static function getProperties(array $exceptions = []): array {
		
		// because we're static, we can't use $this and get_object_vars().
		// we could use the class name and get_class_vars() but then we'd only
		// get public properties, and we want public and protected ones.  so,
		// we'll use a ReflectionClass.
		
		$reflection = new \ReflectionClass(get_called_class());
		$properties = $reflection->getProperties(
			\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED
		);
		
		$temp = [];
		foreach ($properties as $property) {
			$property = $property->getName();
			
			// we don't really care where in the $exceptions we find $property
			// so we'll use in_array(): bool instead of array_search(): mixed
			// here.
			
			if (!in_array($property, $exceptions)) {
				$temp[] = $property;
			}
		}
		
		return $temp;
	}
1325402
public function getGpgInfo($version)
    {
        $phpRelease = preg_replace('~^(\d+\.\d+)\.\d+$~', '\1', $this->resolveVersion($version));

        if (!isset($this->gpgKeys[$phpRelease])) {
            return [];
        }

        return $this->gpgKeys[$phpRelease];
    }
1176668
public function getAllVersions()
    {
        $versions = array();

        foreach ($this->getEntities() as $entity) {
            if ($entity->getVersion()) {
                $versions[$entity->getVersion()] = $entity->getVersion();
            } else {
                $versions['0.0'] = _t('DocumentationManifest.MASTER', 'Master');
            }
        }

        asort($versions);

        return $versions;
    }
1080929
public static function convertVersionMetadata($version)
    {
        $version = str_replace(self::$cleanPatterns, '', $version);

        if (preg_match_all(
            self::createPattern('([a-zA-Z]+|(\-|\+)[a-zA-Z]+|(\-|\+)[0-9]+)'),
            $version,
            $matches,
            PREG_OFFSET_CAPTURE
        )) {
            list($type, $version, $end) = self::cleanVersion(strtolower($version), $matches);
            list($version, $patchVersion) = self::matchVersion($version, $type);

            $matches = array();
            $hasPatchNumber = preg_match('/[0-9]+\.[0-9]+|[0-9]+|\.[0-9]+$/', $end, $matches);
            $end = $hasPatchNumber ? $matches[0] : '1';

            if ($patchVersion) {
                $version .= $end;
            }
        }

        return static::cleanWildcard($version);
    }
14394
protected static function splitUrlVersion($version)
    {
        $pos = strpos($version, '#');

        // number version or empty version
        if (false !== $pos) {
            $url = substr($version, 0, $pos);
            $version = substr($version, $pos);
        } else {
            $url = $version;
            $version = '#';
        }

        return array($url, $version);
    }
344420
private function getContainer(string $namespace, int $version) : array
    {
        return [
             'swagger' => '2.0',
             'info' => [
               'title' => $namespace,
               'version' => $version . '.0',
             ],
             'host' => self::request()->getUri()->getHost(),
             'basePath' => '/Json/' . $namespace . '/v' . $version,
             'schemes' => [
                 self::request()->getUri()->getScheme(),
             ],
             'consumes' => [
                 'application/json',
             ],
             'produces' => [
               'application/json',
               'application/problem+json',
             ],
             'paths' => [],
             'securityDefinitions' => [
               'AuthApiKey' => [
                   'type' => 'apiKey',
                   'name' => 'APIKEY',
                   'in' => 'header',
               ],
               'AuthPassword' => [
                   'type' => 'basic',
               ],
             ],
             'definitions' => ['ApiException' => [
                   'required' => [
                     'status',
                     'message',
                   ],
                   'properties' => [
                     'status' => [
                       'type' => 'integer',
                     ],
                     'message' => [
                       'type' => 'string',
                     ],
                     'type' => [
                       'type' => 'string',
                     ],
                     'stack_trace' => [
                       'type' => 'array', 'items' => [
                         'type' => 'string',
                       ],
                     ],
                     'code' => [
                       'type' => 'integer',
                     ],
                     'detail' => [
                       'type' => 'string',
                     ],
                   ],
                 ],
             ],
           ];
    }
422868
private function getObjectPropertiesValues($object)
    {
        $properties = Core::get()->getGettablePropertiesOfObject($object);
        $finalProperties = [];

        foreach ($properties as $property) {
            $finalProperties[$property] = Core::get()->getObjectService()->getObjectProperty($object, $property);
        }

        return $finalProperties;
    }
915855
public static function parse ($version)
    {
        $nums = explode(self::DELIMITER, $version);
        $numbers = array();
        foreach ($nums as $num) {
            if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
                if (isset($matches[1])) {
                    $numbers[] = $matches[1];
                } else {
                    $numbers[] = 0;
                }
            } else {
                break;
            }
        }
        if (! sizeof($numbers)) {
            $numbers = array(0);
        }
        return $numbers;
    }
936312
protected function getPackageVersions($obj)
    {
        $result = [];
        if ($obj instanceof PackageVersionEntity) {
            $result[] = $obj;
        } elseif (is_array($obj)) {
            $app = Application::getFacadeApplication();
            if (isset($obj['handle']) && isset($obj['version'])) {
                $pv = $app->make(PackageVersionRepository::class)->findByHandleAndVersion(
                    $obj['handle'],
                    $obj['version']
                );
                if ($pv === null) {
                    throw new UserMessageException(t('Invalid translated package specified'));
                }
                $result[] = $pv;
            } elseif (isset($obj[0]) && is_string($obj[1]) && isset($obj[1]) && is_string($obj[1])) {
                $pv = $app->make(PackageVersionRepository::class)->findByHandleAndVersion(
                    $obj[0],
                    $obj[1]
                );
                if ($pv === null) {
                    throw new UserMessageException(t('Invalid translated package specified'));
                }
                $result[] = $pv;
            } else {
                foreach ($obj as $item) {
                    $result = array_merge($result, $this->getPackageVersions($item));
                }
            }
        }
        if (empty($result)) {
            throw new UserMessageException(t('Invalid translated package specified'));
        }

        return $result;
    }
563535
public function version($version = null)
    {
        if (!$version) {
            $versionParts = explode('.', \Peridot\Console\Version::NUMBER);
            $versionParts[count($versionParts)-1]++;
            $version = implode('.', $versionParts);
        }
        $versionFile = __DIR__ . '/src/Console/Version.php';
        $this->taskReplaceInFile($versionFile)
            ->from('NUMBER = "' . \Peridot\Console\Version::NUMBER . '"')
            ->to('NUMBER = "' . $version . '"')
            ->run();

        return $version;
    }
867841
public function getDetectedVersion($version)
    {
        return isset($this->detectedVersions[$version]) ? $this->detectedVersions[$version] : null;
    }
1121467
protected function getStaticFieldValues(ObjectInterface $version)
    {
        /** @var \Concrete\Core\Page\Collection\Version\Version $version */

        /** @var \Concrete\Core\Page\Page $page */
        $page = Page::getByID($version->getCollectionID());

        yield (int) $page->getCollectionID();
        yield (string) $page->getCollectionPath();
        yield (string) $page->getCollectionName();
        yield (int) $version->getVersionID();
        yield (string) $this->getLocalizedDate($version->getVersionDateApproved());
        yield (string) $version->getVersionComments();
        yield (string) $version->getVersionAuthorUserName();
        yield (string) $version->getVersionApproverUserName();
    }