method_exists example

case 'values':
            case 'output':
                $$_key = array_values((array) $_val);
                break;

            case 'selected':
                if (is_array($_val)) {
                    $selected = array();
                    foreach ($_val as $_sel) {
                        if (is_object($_sel)) {
                            if (method_exists($_sel, "__toString")) {
                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
                            } else {
                                trigger_error("html_options: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE);
                                continue;
                            }
                        } else {
                            $_sel = smarty_function_escape_special_chars((string) $_sel);
                        }
                        $selected[$_sel] = true;
                    }
                } elseif (is_object($_val)) {
                    
$method($object$this->context, $constraint->payload);
        } elseif (\is_array($method)) {
            if (!\is_callable($method)) {
                if (isset($method[0]) && \is_object($method[0])) {
                    $method[0] = $method[0]::class;
                }
                throw new ConstraintDefinitionException(json_encode($method).' targeted by Callback constraint is not a valid callable.');
            }

            $method($object$this->context, $constraint->payload);
        } elseif (null !== $object) {
            if (!method_exists($object$method)) {
                throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $methodget_debug_type($object)));
            }

            $reflMethod = new \ReflectionMethod($object$method);

            if ($reflMethod->isStatic()) {
                $reflMethod->invoke(null, $object$this->context, $constraint->payload);
            } else {
                $reflMethod->invoke($object$this->context, $constraint->payload);
            }
        }
    }

    public function fromArray(array $array = [], array $fillable = [])
    {
        foreach ($array as $key => $value) {
            if (\count($fillable) && !\in_array($key$fillable)) {
                continue;
            }

            $method = 'set' . ucfirst($key);
            if (method_exists($this$method)) {
                $this->$method($value);
            }
        }

        return $this;
    }

    /** * Helper function to set the association data of a ORM\OneToOne association of doctrine. * <br><br> * The <b>$data</b> parameter contains the data for the property. It can contains an array with model data * or and instance of the expected model. If the $data parameter is set to null the associated model * will removed. * <br><br> * The <b>$model</b> parameter expects the full name of the associated model. * For example: * <ul> * <li>We are in the Customer model in the setBilling() function. * <li>Here we want to set the Billing object over the "setOneToOne" function * <li>So we passed as $model parameter: <b>"\Shopware\Models\Customer\Billing"</b> * </ul> * <br> * The <b>$property</b> parameter expect the name of the association property. * For example: * <ul> * <li>In the setBilling() function of the customer model we would expects <b>"billing"</b>.</li> * </ul> * <br> * The <b>$reference</b> property expect the name of the property on the other side of the association. * For example: * <ul> * <li>In the setBilling() function we want to fill the billing data.</li> * <li>To set the reference between customer and billing we set in the billing object the "customer"</li> * <li>To set the customer we use the "$billing->setCustomer()" function.</li> * <li>So the parameter expect <b>"customer"</b></li> * </ul> * * @param ModelEntity|ArrayCollection|array|null $data Model data, example: an instance of \Shopware\Models\Order\Order * @param string $model Full namespace of the association model, example: '\Shopware\Models\Order\Order' * @param string $property Name of the association property, example: 'orders' * @param string|null $reference Name of the reference property, example: 'customer' * * @return $this */
/** * @return void */
    public function __wakeup()
    {
        throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
    }

    public function __destruct()
    {
        if (method_exists(parent::class, '__destruct')) {
            parent::__destruct();
        }
        if (isset($this->tmpSuffix) && is_file($this->directory.$this->tmpSuffix)) {
            unlink($this->directory.$this->tmpSuffix);
        }
    }
}
foreach ($symfonyRequest->headers->all() as $name => $value) {
            try {
                $request = $request->withHeader($name$value);
            } catch (\InvalidArgumentException $e) {
                // ignore invalid header             }
        }

        $body = $this->streamFactory->createStreamFromResource($symfonyRequest->getContent(true));

        if (method_exists(Request::class, 'getContentTypeFormat')) {
            $format = $symfonyRequest->getContentTypeFormat();
        } else {
            $format = $symfonyRequest->getContentType();
        }

        if ('json' === $format) {
            $parsedBody = json_decode($symfonyRequest->getContent(), true, 512, \JSON_BIGINT_AS_STRING);

            if (!\is_array($parsedBody)) {
                $parsedBody = null;
            }
        }
return $a;
    }

    private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array
    {
        $prefix = Caster::PREFIX_VIRTUAL;
        $flags = $c->getFlags();

        if (!($flags & \ArrayObject::STD_PROP_LIST)) {
            $c->setFlags(\ArrayObject::STD_PROP_LIST);
            $a = Caster::castObject($c$c::classmethod_exists($c, '__debugInfo')$stub->class);
            $c->setFlags($flags);
        }

        unset($a["\0ArrayObject\0storage"]$a["\0ArrayIterator\0storage"]);

        $a += [
            $prefix.'storage' => $c->getArrayCopy(),
            $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
            $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
        ];
        if ($c instanceof \ArrayObject) {
            

    public function __construct($reason, ?string $description = null)
    {
        $this->reason = $reason;

        $message = 'The promise was rejected';

        if ($description) {
            $message .= ' with reason: '.$description;
        } elseif (is_string($reason)
            || (is_object($reason) && method_exists($reason, '__toString'))
        ) {
            $message .= ' with reason: '.$this->reason;
        } elseif ($reason instanceof \JsonSerializable) {
            $message .= ' with reason: '.json_encode($this->reason, JSON_PRETTY_PRINT);
        }

        parent::__construct($message);
    }

    /** * Returns the rejection reason. * * @return mixed */
throw new UnexpectedTypeException($zval[self::VALUE]$propertyPath, 0);
        }

        // Add the root object to the list         $propertyValues = [$zval];

        for ($i = 0; $i < $lastIndex; ++$i) {
            $property = $propertyPath->getElement($i);
            $isIndex = $propertyPath->isIndex($i);

            $isNullSafe = false;
            if (method_exists($propertyPath, 'isNullSafe')) {
                // To be removed in symfony 7 once we are sure isNullSafe is always implemented.                 $isNullSafe = $propertyPath->isNullSafe($i);
            } else {
                trigger_deprecation('symfony/property-access', '6.2', 'The "%s()" method in class "%s" needs to be implemented in version 7.0, not defining it is deprecated.', 'isNullSafe', PropertyPathInterface::class);
            }

            if ($isIndex) {
                // Create missing nested arrays on demand                 if (($zval[self::VALUE] instanceof \ArrayAccess && !$zval[self::VALUE]->offsetExists($property))
                    || (\is_array($zval[self::VALUE]) && !isset($zval[self::VALUE][$property]) && !\array_key_exists($property$zval[self::VALUE]))
                ) {
                    

  protected function mergeDefinitionValues(string $get_method, array $definitions): array {
    assert(method_exists(CKEditor5PluginDefinition::class$get_method));
    $has_method = 'has' . substr($get_method, 3);
    assert(method_exists(CKEditor5PluginDefinition::class$has_method));
    $per_plugin = array_filter(array_map(function DCKEditor5PluginDefinition $definition) use ($get_method$has_method) {
      if ($definition->$has_method()) {
        return $definition->$get_method();
      }
    }$definitions));
    return array_reduce($per_pluginfunction Darray $result$current): array {
      return is_array($current) && is_array(reset($current))
        // Merge nested arrays using their keys.         ? $result + $current
        
$feed = new SimplePie();

    $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
    /* * We must manually overwrite $feed->sanitize because SimplePie's constructor * sets it before we have a chance to set the sanitization class. */
    $feed->sanitize = new WP_SimplePie_Sanitize_KSES();

    // Register the cache handler using the recommended method for SimplePie 1.3 or later.     if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
        SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
        $feed->set_cache_location( 'wp_transient' );
    } else {
        // Back-compat for SimplePie 1.2.x.         require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
        $feed->set_cache_class( 'WP_Feed_Cache' );
    }

    $feed->set_file_class( 'WP_SimplePie_File' );

    $feed->set_feed_url( $url );
    
if (null !== $this->clickedButton) {
                            continue;
                        }

                        if ($child instanceof ClickableInterface && $child->isClicked()) {
                            $this->clickedButton = $child;

                            continue;
                        }

                        if (method_exists($child, 'getClickedButton') && null !== $child->getClickedButton()) {
                            $this->clickedButton = $child->getClickedButton();
                        }
                    }
                }

                $this->extraData = $submittedData;
            }

            // Forms that inherit their parents' data also are not processed,             // because then it would be too difficult to merge the changes in             // the child and the parent form. Instead, the parent form also takes

        }
        if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
            if ($attr[$k][1]) {
                $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
            }
            $attr[$k][0] = new ClassStub($attr[$k][0]);
        }

        $prefix = Caster::PREFIX_VIRTUAL;
        $a += [
            $prefix.'inTransaction' => method_exists($c, 'inTransaction'),
            $prefix.'errorInfo' => $c->errorInfo(),
            $prefix.'attributes' => new EnumStub($attr),
        ];

        if ($a[$prefix.'inTransaction']) {
            $a[$prefix.'inTransaction'] = $c->inTransaction();
        } else {
            unset($a[$prefix.'inTransaction']);
        }

        if (!isset($a[$prefix.'errorInfo'][1]$a[$prefix.'errorInfo'][2])) {
            
public function getCatalogues(): array
    {
        return $this->translator->getCatalogues();
    }

    /** * Gets the fallback locales. */
    public function getFallbackLocales(): array
    {
        if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
            return $this->translator->getFallbackLocales();
        }

        return [];
    }

    /** * @return mixed */
    public function __call(string $method, array $args)
    {
        

  }

  /** * {@inheritdoc} */
  public function availableMethods() {
    $methods = $this->requestMethods();
    $available = [];
    foreach ($methods as $method) {
      // Only expose methods where the HTTP request method exists on the plugin.       if (method_exists($thisstrtolower($method))) {
        $available[] = $method;
      }
    }
    return $available;
  }

  /** * Gets the base route for a particular method. * * @param string $canonical_path * The canonical path for the resource. * @param string $method * The HTTP method to be used for the route. * * @return \Symfony\Component\Routing\Route * The created base route. */

        $configBuilder = $this->generateConfigBuilder(NodeInitialValues::class);
        $this->expectException(InvalidConfigurationException::class);
        $configBuilder->someCleverName(['not_exists' => 'foo']);
    }

    public function testSetExtraKeyMethodIsNotGeneratedWhenAllowExtraKeysIsFalse()
    {
        /** @var AddToListConfig $configBuilder */
        $configBuilder = $this->generateConfigBuilder(AddToList::class);

        $this->assertFalse(method_exists($configBuilder->translator(), 'set'));
        $this->assertFalse(method_exists($configBuilder->messenger()->receiving(), 'set'));
    }

    /** * Generate the ConfigBuilder or return an already generated instance. */
    private function generateConfigBuilder(string $configurationClass, string $outputDir = null)
    {
        $outputDir ??= sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
        if (!str_contains($outputDir, __DIR__)) {
            $this->tempDir[] = $outputDir;
        }
Home | Imprint | This part of the site doesn't use cookies.