Gets the validations.

@param string|null $class The class namespace

@return array
966331
public function getValidations($class = null)
    {
        $reflectionClass = $class ? new \ReflectionClass($class) : false;
        if ($reflectionClass === false) {
            return [];
        }
        $result = $this->buildValidation($class);
        $validations = [];
        foreach ($result as $keyElement => $element) {
            if (is_array($element)) {
                foreach ($element as $keyChild => $child) {
                    if (is_array($child)) {
                        foreach ($child as $grandChild) {
                            $validations[] = sprintf('%s => %s', $keyChild, $grandChild);
                        }
                    } else {
                        $validations[] = sprintf('%s => %s', $keyElement, $child);
                    }
                }
            } else {
                $validations[] = $element;
            }
        }

        return $validations;
    }
1252238
protected function getValidAlgorithm($class)
    {
        $logging = \Plop\Plop::getInstance();;
        $w =    'abcdefghijklmnopqrstuvwxyz' .
                'ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
                '1234567890-@.';
        $name = $class::getName();
        if (!is_string($name) || strspn($name, $w) !== strlen($name)) {
            $logging->debug(
                'Skipping algorithm "%(name)s" (invalid algorithm name)',
                array('name' => $name)
            );
            return null;
        }
        return $name;
    }
1237484
public function getBasicDefinition($class)
    {
        if (!class_exists($class)) {
            throw new \InvalidArgumentException("$class is not a valid class name");
        }

        $definition = new Definition($class, []);

        $traits = $this->classUsesDeep($class);
        foreach ($traits as $trait) {
            switch ($trait) {
                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesEvaluator':
                    $definition->addMethodCall('setEvaluator', [new Reference('smartesb.util.evaluator')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesSerializer':
                    $definition->addMethodCall('setSerializer', [new Reference('jms_serializer')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesValidator':
                    $definition->addMethodCall('setValidator', [new Reference('validator')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesEventDispatcher':
                    $definition->addMethodCall('setEventDispatcher', [new Reference('event_dispatcher')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesEndpointFactory':
                    $definition->addMethodCall('setEndpointFactory', [new Reference('smartesb.endpoint_factory')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesEndpointRouter':
                    $definition->addMethodCall('setEndpointsRouter', [new Reference('smartesb.router.endpoints')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\MessageFactoryAware':
                    $definition->addMethodCall('setMessageFactory', [new Reference('smartesb.message_factory')]);
                    break;

                case 'Smartbox\Integration\FrameworkBundle\DependencyInjection\Traits\UsesCacheService':
                    $definition->addMethodCall('setCacheService', [new Reference('smartcore.cache_service')]);
                    break;

                case 'Symfony\Component\DependencyInjection\ContainerAwareTrait':
                    $definition->addMethodCall('setContainer', [new Reference('service_container')]);
                    break;
            }
        }

        return $definition;
    }
414550
public function fetchAllObj(string $class = null): array
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        if ($class === null) {
            return $this->getAdapter()->getStatement()->fetchAll(PDO::FETCH_OBJ);
        } else {
            $objects = [];
            foreach ($this->fetchAll() as $record) {
                $objects[] = new $class($record);
            }

            return $objects;
        }
    }
820690
private function getObjectMapping(string $class): ValidationMappingProviderInterface
    {
        try {
            return $this->validatorObjectMappingRegistry->provideMapping($class);
        } catch (ValidatorLogicException $exception) {
            $this->logger->error('validate: {exception}', ['exception' => $exception->getMessage()]);

            throw $exception;
        }
    }
454174
public static function getInstance($class = null)
    {
        static $instance = [];
        if (!empty($class)) {
            if (!$instance || strtolower($class) !== strtolower(get_class($instance[0]))) {
                $instance[0] = new $class();
            }
        }
        if (!$instance) {
            $instance[0] = new Debugger();
        }

        return $instance[0];
    }
771686
public function forgeEntity($data, $class = null) {
		if(empty($data)) {
			return [];
		}
		if(empty($class)) {
			$class = $this->id;
		}
		$array = ArrayHelper::toArray($data);
		$array = $this->getAlias()->decode($array);
		return $this->domain->factory->entity->create($class, $array);
	}
384876
protected function getValuesForValidation($data = null)
  {
    $out = array();
    foreach ($this->fields as $field => $el) {
      $out[$field] = !is_null($data)
        ? isset($data[$field]) ? $data[$field] : false
        : $this->getValueFromRequest($field);
    }

    return $out;
  }
422888
public function getDescendantsOf($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        $lClass = strtolower($class);
        if (array_key_exists($lClass, $this->descendants)) {
            return $this->descendants[$lClass];
        }

        return [];
    }
873816
public function getValidationMessages($property = null) {
		if ($this->_validatorsMessages === null) {
			return;
		}
		
		if ($property === null) {
			return $this->_validatorsMessages;
		}
		
		if (isset($this->_validatorsMessages[$property])) {
			return $this->_validatorsMessages[$property];
		}
	}
458489
public function fullyQualifiedName($class)
    {
        if ($this->namespace) {
            $namespace = str_replace('\\\\', '\\', '\\' . $this->namespace . '\\');
        } else {
            $namespace = '\\'; // global namespace
        }

        if ($this->class === null) {
            $this->class = '';
        }

        if ($class === null) {
            return '';
        }

        if (strcasecmp($class, $this->class) === 0) {
            return $namespace . $this->class;
        }
        $pos = strpos($class, '\\');
        if ($pos !== false) {
            if ($pos === 0) {
                // Fully qualified name (\Foo\Bar)
                return $class;
            }
            // Qualified name (Foo\Bar)
            if ($this->uses) {
                foreach ($this->uses as $alias => $aliasedNamespace) {
                    $alias .= '\\';
                    if (strcasecmp(substr($class, 0, strlen($alias)), $alias) === 0) {
                        // Aliased namespace (use \Long\Namespace as Foo)
                        return '\\' . $aliasedNamespace . substr($class, strlen($alias) - 1);
                    }
                }
            }
        } elseif ($this->uses) {
            // Unqualified name (Foo)
            foreach ($this->uses as $alias => $aliasedNamespace) {
                if (strcasecmp($alias, $class) === 0) {
                    return '\\' . $aliasedNamespace;
                }
            }
        }

        return $namespace . $class;
    }
929401
public function getNormalizedValidationRules()
    {
        $rules = json_decode($this->get('validation'), true);

        if ( ! is_string($rules) && ! is_array($rules)) {
            return null;
        }

        return $rules;
    }
634424
public static function getNamespace($class)
    {
        if (is_object($class) === true) {
            $class = get_class($class);
        }
        foreach (['\\', '_'] as $separator) {
            $pos = strrpos($class, $separator);
            if ($pos !== false) {
                return ltrim(substr($class, 0, $pos), $separator);
            }
        }
        return '';
    }
1181613
private function classLineage($class, $ident = null)
    {
        if (!is_string($class)) {
            return [];
        }

        if ($ident === null) {
            $ident = $this->metaKeyFromClassName($class);
        }

        if (isset(static::$lineageCache[$ident])) {
            return static::$lineageCache[$ident];
        }

        $class = $this->classNameFromMetaKey($ident);

        if (!class_exists($class) && !interface_exists($class)) {
            return [ $ident ];
        }

        $classes   = array_values(class_parents($class));
        $classes   = array_reverse($classes);
        $classes[] = $class;

        $hierarchy = [];
        foreach ($classes as $class) {
            $implements = array_values(class_implements($class));
            $implements = array_reverse($implements);
            foreach ($implements as $interface) {
                $hierarchy[$this->metaKeyFromClassName($interface)] = 1;
            }
            $hierarchy[$this->metaKeyFromClassName($class)] = 1;
        }

        $hierarchy = array_keys($hierarchy);

        static::$lineageCache[$ident] = $hierarchy;

        return $hierarchy;
    }
310856
public function find($class)
    {
        $reflectionClass = new \ReflectionClass($class);

        do {
            $classNamespace = $reflectionClass->getNamespaceName();
            foreach ($this->bundles as $bundleName => $bundleClass) {
                $bundleNamespace = \substr($bundleClass, 0, \strrpos($bundleClass, '\\'));
                if (0 === \strpos($classNamespace, $bundleNamespace)) {
                    return $bundleName;
                }
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);

        return null;
    }
566508
public function getParentOfClass($class)
    {
        // Check for namespace alias
        if (strpos($class, ':') !== false) {
            list($namespaceAlias, $simpleClassName) = explode(':', $class);
            $class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
        }
        if ($this->getParent() === null) {
            return null;
        }
        if ($this->parent->getPage() instanceof $class) {
            return $this->parent;
        }

        return $this->parent->getParentOfClass($class);
    }
742123
public function getEntityIdentifiers($class)
    {
        $registry = $this->getService('application.registry', array('key' => $this->getIdentifier()));

        if (!$registry->offsetExists($class.'-identifiers')) {
            $path = ANPATH_ROOT.DS.'components'.DS.'com_'.$this->getIdentifier()->package.DS.'domains'.DS.'entities';

            $identifiers = array();

            if (file_exists($path)) {

                //scandir without . and .. hiident directories
                $files = array_values(preg_grep('/^([^.])/', scandir($path)));

                foreach ($files as $file) {
                    $name = explode('.', basename($file));
                    $name = $name[0];
                    $identifier = clone $this->getIdentifier();
                    $identifier->path = array('domain','entity');
                    $identifier->name = $name;

                    try {
                        if (is($identifier->classname, $class)) {
                            $identifiers[] = $identifier;
                        }
                    } catch (Exception $e) {
                    }
                }
            }

            $registry->offsetSet($class.'-identifiers', $identifiers);
        }

        $identifiers = $registry->offsetGet($class.'-identifiers');

        return $identifiers;
    }