private function isTrivialInstance(Definition $definition)
    {
        if ($definition->isSynthetic() || $definition->getFile() || $definition->getMethodCalls() || $definition->getProperties() || $definition->getConfigurator()) {
            return false;
        }
        if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < count($definition->getArguments())) {
            return false;
        }

        foreach ($definition->getArguments() as $arg) {
            if (!$arg || $arg instanceof Parameter) {
                continue;
            }
            if (is_array($arg) && 3 >= count($arg)) {
                foreach ($arg as $k => $v) {
                    if ($this->dumpValue($k) !== $this->dumpValue($k, false)) {
                        return false;
                    }
                    if (!$v || $v instanceof Parameter) {
                        continue;
                    }
                    if ($v instanceof Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) {
                        continue;
                    }
                    if (!is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, false)) {
                        return false;
                    }
                }
            } elseif ($arg instanceof Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) {
                continue;
            } elseif (!is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, false)) {
                return false;
            }
        }

        if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) {
            return false;
        }

        return true;
    }
private function isTrivialInstance(Definition $definition)
    {
        if ($definition->isSynthetic() || $definition->getFile() || $definition->getMethodCalls() || $definition->getProperties() || $definition->getConfigurator()) {
            return false;
        }
        if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < count($definition->getArguments())) {
            return false;
        }

        foreach ($definition->getArguments() as $arg) {
            if (!$arg || $arg instanceof Parameter) {
                continue;
            }
            if (is_array($arg) && 3 >= count($arg)) {
                foreach ($arg as $k => $v) {
                    if ($this->dumpValue($k) !== $this->dumpValue($k, false)) {
                        return false;
                    }
                    if (!$v || $v instanceof Parameter) {
                        continue;
                    }
                    if ($v instanceof Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) {
                        continue;
                    }
                    if (!is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, false)) {
                        return false;
                    }
                }
            } elseif ($arg instanceof Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) {
                continue;
            } elseif (!is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, false)) {
                return false;
            }
        }

        if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) {
            return false;
        }

        return true;
    }
private function isTrivialInstance ( Definition $ definition ) { if ( $ definition -> isSynthetic ( ) || $ definition -> getFile ( ) || $ definition -> getMethodCalls ( ) || $ definition -> getProperties ( ) || $ definition -> getConfigurator ( ) ) { return false ; } if ( $ definition -> isDeprecated ( ) || $ definition -> isLazy ( ) || $ definition -> getFactory ( ) || 3 < count ( $ definition -> getArguments ( ) ) ) { return false ; } foreach ( $ definition -> getArguments ( ) as $ arg ) { if ( ! $ arg || $ arg instanceof Parameter ) { continue ; } if ( is_array ( $ arg ) && 3 >= count ( $ arg ) ) { foreach ( $ arg as $ k => $ v ) { if ( $ this -> dumpValue ( $ k ) !== $ this -> dumpValue ( $ k , false ) ) { return false ; } if ( ! $ v || $ v instanceof Parameter ) { continue ; } if ( $ v instanceof Reference && $ this -> container -> has ( $ id = ( string ) $ v ) && $ this -> container -> findDefinition ( $ id ) -> isSynthetic ( ) ) { continue ; } if ( ! is_scalar ( $ v ) || $ this -> dumpValue ( $ v ) !== $ this -> dumpValue ( $ v , false ) ) { return false ; } } } elseif ( $ arg instanceof Reference && $ this -> container -> has ( $ id = ( string ) $ arg ) && $ this -> container -> findDefinition ( $ id ) -> isSynthetic ( ) ) { continue ; } elseif ( ! is_scalar ( $ arg ) || $ this -> dumpValue ( $ arg ) !== $ this -> dumpValue ( $ arg , false ) ) { return false ; } } if ( false !== strpos ( $ this -> dumpLiteralClass ( $ this -> dumpValue ( $ definition -> getClass ( ) ) ) , '$' ) ) { return false ; } return true ; }
Checks if the definition is a trivial instance.

@param Definition $definition

@return bool
Checks if the definition is a trivial instance .