Figure out a normalized data type (for documentation), and get a
nested class name, if available.

@return array
495942
protected function processDataType(PropertyMetadata $item)
    {
        // check for a type inside something that could be treated as an array
        if ($nestedType = $this->getNestedTypeInArray($item)) {
            if ($this->isPrimitive($nestedType)) {
                return array(
                    'normalized' => sprintf('array of %ss', $nestedType),
                    'class' => null,
                );
            }

            $exp = explode('\\', $nestedType);

            return array(
                'normalized' => sprintf('array of objects (%s)', end($exp)),
                'class' => $nestedType,
            );
        }

        $type = $item->type['name'];

        // could be basic type
        if ($this->isPrimitive($type)) {
            return array(
                'normalized' => $type,
                'class' => null,
            );
        }

        // we can use type property also for custom handlers, then we don't have here real class name
        if (!class_exists($type)) {
            return array(
                'normalized' => sprintf('custom handler result for (%s)', $type),
                'class' => null,
            );
        }

        // if we got this far, it's a general class name
        $exp = explode('\\', $type);

        return array(
            'normalized' => sprintf('object (%s)', end($exp)),
            'class' => $type,
        );
    }
619940
private function parseClass()
    {
        // check which interfaces are implemented
        $interfaces = [];
        foreach ($this->parentClasses as $pc) {
            $interfaces = array_merge($interfaces,
                $pc->getInterfaceNames()); // returns only the interfaces that the current class implements
        }
        $interfaces = array_unique($interfaces);

        foreach ($interfaces as $i) {
            if ($i == AccessInterface::class) {
                $this->parsedClass->accessInterface = true;
            }

            if ($i == CacheKeyInterface::class) {
                $this->parsedClass->cacheKeyInterface = true;
            }
        }
    }
664099
public static function getTypes() {
        return array(
            self::TYPE_CHARACTER,
            self::TYPE_LOGICAL,
            self::TYPE_DATE ,
            self::TYPE_NUMERIC,
            self::TYPE_MEMO,
        );
    }
708725
public function info()
    {
        $data = [];
        foreach ($this->attributes as $key => $value) {
            switch (gettype($value)) {
                case 'boolean':
                    $data[$key] = [
                        'boolValue' => $value
                    ];
                    break;
                case 'integer':
                    $data[$key] = [
                        'intValue' => $value
                    ];
                    break;
                default:
                    $data[$key] = [
                        'stringValue' => ['value' => (string) $value]
                    ];
            }
        }
        return [
            'attributeMap' => $data
        ];
    }
380910
protected function getType(): string
    {
        return join('|', array_filter([
            $this->traversable,
            isset($this->subtype) ? $this->subtype . '[]' : null
        ])) ?: 'array';
    }
437187
public static function getTypesMap()
    {
        return array_map(
            static function (Type $type) : string {
                return get_class($type);
            },
            self::getTypeRegistry()->getMap()
        );
    }
666110
function getTypes()
    {
        $t = array();
        foreach ($this->getElements('xrd:Type') as $elem) {
            $c = $this->parser->content($elem);
            if ($c) {
                $t[] = $c;
            }
        }
        return $t;
    }
309416
protected function getDataTypes(): array
    {
        $dataTypes = array_keys($this->module->dataTypes);

        // If include is specified.
        if (null !== $this->include) {
            $dataTypes = $this->applyIncludes($dataTypes);
        }

        // If there are exclusions.
        if (null !== $this->exclude) {
            $dataTypes = $this->applyExcludes($dataTypes);
        }

        //Import fields and usergroups again after all sources have been imported
        if (array_search('fields', $dataTypes) && count($dataTypes) > 1) {
            $dataTypes[] = 'fields';
            $dataTypes[] = 'userGroups';
        }

        return $dataTypes;
    }
392112
protected static function getAttrs()
    {
        $class = get_called_class();
        $parent = get_parent_class($class);
        if ($parent) {
            $attrs_parent = $parent::getAttrs();
            $attrs = array_merge($attrs_parent, $class::$attrs);
        } else {
            $attrs = $class::$attrs;
        }
        if(empty($attrs)) $attrs = array();

        return array_diff_key($attrs, array('__private__'));

    }
765679
private function getClasses()
    {
        $r = '';

        // Inside classes
        foreach ($this->modules as $module) {
            $classes = (array)$this->xml->xpath('/draggy/module[@name=\'' . $module . '\']/class');

            foreach ($classes as $class) {
                $classAttributes = (array)$class;
                $classAttributes = (array)$classAttributes['@attributes'];

                $this->checkMandatoryAttributes('Class in module ' . $module, $classAttributes, ['name']);

                $className = $classAttributes['name'];

                $this->insideClasses[$module][] = $className;

                $this->checkMandatoryAttributes(
                    'Class ' . $className . ' in module ' . $module,
                    $classAttributes,
                    ['left', 'top']
                );

                $r .= 'var c = new Class(\'' . $classAttributes['name'] . '\',\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\');' . PHP_EOL;
                $r .= 'c.moveTo(\'' . ( $classAttributes['left'] /*- 1*/ ) . 'px\',\'' . ( $classAttributes['top'] /*- 1*/ ) . 'px\');' . PHP_EOL;

                $r .= $this->getClassLikeProperties($classAttributes, 'c');

                $r .= 'c.setModule(Container.prototype.getContainerByName(\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\').getId());' . PHP_EOL;
            }
        }

        // Outside classes
        $classes = (array)$this->xml->xpath('/draggy/loose/class');

        foreach ($classes as $class) {
            $classAttributes = (array)$class;
            $classAttributes = $classAttributes['@attributes'];

            $this->checkMandatoryAttributes('Loose class', $classAttributes, ['name']);

            $className = $classAttributes['name'];

            $this->outsideClasses[] = $className;

            $this->checkMandatoryAttributes('Loose class ' . $className, $classAttributes, ['left', 'top']);

            $r .= 'var c = new Class(\'' . $className . '\');' . PHP_EOL;
            $r .= 'c.moveTo(\'' . ( $classAttributes['left'] ) . 'px\',\'' . ( $classAttributes['top'] ) . 'px\');' . PHP_EOL;

            $r .= $this->getClassLikeProperties($classAttributes, 'c');
        }

        return $r;
    }
747364
public function getType()
    {
        if (!empty($this->type)) {
            return $this->type;
        }

        if ($this->getDbColumnJoin()) {
            // best guess
            return self::TYPE_TEXT;
        }

        if ($this->getEnumColumnValues()) {
            // best guess
            return self::TYPE_ENUM;
        }

        if (!empty($this->columnType)) {
            // best guess
            $type = strtolower($this->columnType);
            if (strpos($type, 'datetime') !== false) {
                return self::TYPE_DATETIME;
            } elseif (strpos($type, 'timestamp') !== false) {
                return self::TYPE_TIMESTAMP;
            } elseif (strpos($type, 'date') !== false) {
                return self::TYPE_DATE;
            } elseif (strpos($type, 'time') !== false) {
                return self::TYPE_TIME;
            } elseif (strpos($type, 'float') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'decimal') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'int') !== false) {
                return self::TYPE_NUMBER;
            } elseif (strpos($type, 'binary') !== false) {
                return self::TYPE_BINARY;
            }
        }

        return self::TYPE_TEXT;
    }
669452
protected function getTypeName()
    {
        $result = $this->type;
        foreach (get_defined_constants() as $name => $value) {
            if (substr($name, 0, 2) === 'T_' && $value === $this->type) {
                $result = $name;
                break;
            }
        }

        return $result;
    }
937661
public function getTypes()
    {
        if (!array_key_exists('value', $this->types)) {
            return;
        }

        //return an array, no matter one or many types defined
        if (is_array($this->types['value']) && count($this->types['value']) > 1) {
            return $this->types['value'];
        } else {
            return [$this->types['value']];
        }
    }
249076
protected static function getModelTypes()
    {
        $class = get_called_class();

        if($class::$useType === false) {
            return array();
        }

        $class_name = $class::getClassName(false);
        $parent = get_parent_class($class);
        if ($parent) {
            $names_parent = $parent::getModelTypes();
            $names = array_merge($names_parent, array($class_name));
        } else {
            $names = array();
        }

        return $names;

    }
21181
public function getMappedClasses()
    {
        if (null === $this->classes) {
            $this->classes = $this->getClassesFromYaml();
        }

        return array_keys($this->classes);
    }
1266806
public function getClassNameForExtraClass() {
		$classes = [];
		foreach (array_reverse(\ClassInfo::ancestry($this->class)) as $class) {
			if ($class == self::class) {
				break;
			}
			$class = explode('_ContentElement_', $class, 2);
			$classes[] = 'ContentElement-' . end($class);
		}
		return $classes;
	}
1097807
public function getTypeName()
    {
        if (isset($this->resourceType)) {
            return $this->resourceType;
        }
        $classInfo = explode("\\", get_class($this));
        return end($classInfo);
    }