is_callable example


  public function doSyncStep($sync_step, &$context) {
    if (is_string($sync_step) && method_exists($this$sync_step)) {
      \Drupal::service('config.installer')->setSyncing(TRUE);
      $this->$sync_step($context);
    }
    elseif (is_callable($sync_step)) {
      \Drupal::service('config.installer')->setSyncing(TRUE);
      $sync_step($context$this);
    }
    else {
      throw new \InvalidArgumentException('Invalid configuration synchronization step');
    }
    \Drupal::service('config.installer')->setSyncing(FALSE);
  }

  /** * Initializes the config importer in preparation for processing a batch. * * @return array * An array of \Drupal\Core\Config\ConfigImporter method names and callables * that are invoked to complete the import. If there are modules or themes * to process then an extra step is added. * * @throws \Drupal\Core\Config\ConfigImporterException * If the configuration is already importing. */
foreach ($definition['properties'] as $key => $value) {
        $service->{$key} = $value;
      }
    }

    if (isset($definition['configurator'])) {
      $callable = $definition['configurator'];
      if (is_array($callable)) {
        $callable = $this->resolveServicesAndParameters($callable);
      }

      if (!is_callable($callable)) {
        throw new InvalidArgumentException(sprintf('The configurator for class "%s" is not a callable.', get_class($service)));
      }

      call_user_func($callable$service);
    }

    return $service;
  }

  /** * {@inheritdoc} * * phpcs:ignore Drupal.Commenting.FunctionComment.VoidReturn * @return void */
/** * Sets the {@link ClassMetadataFactoryInterface} to use. */
    public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, array $defaultContext = [])
    {
        $this->classMetadataFactory = $classMetadataFactory;
        $this->nameConverter = $nameConverter;
        $this->defaultContext = array_merge($this->defaultContext, $defaultContext);

        $this->validateCallbackContext($this->defaultContext, 'default');

        if (isset($this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER]) && !\is_callable($this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER])) {
            throw new InvalidArgumentException(sprintf('Invalid callback found in the "%s" default context option.', self::CIRCULAR_REFERENCE_HANDLER));
        }
    }

    /** * @deprecated since Symfony 6.3, use "getSupportedTypes()" instead */
    public function hasCacheableSupportsMethod(): bool
    {
        trigger_deprecation('symfony/serializer', '6.3', 'The "%s()" method is deprecated, implement "%s::getSupportedTypes()" instead.', __METHOD__, get_debug_type($this));

        

    public function call($callback, array $parameters = array()$tags = array()$specificLifetime = false, $priority = 8)
    {
        if (!is_callable($callback, true, $name)) {
            Zend_Cache::throwException('Invalid callback');
        }

        $cacheBool1 = $this->_specificOptions['cache_by_default'];
        $cacheBool2 = in_array($name$this->_specificOptions['cached_functions']);
        $cacheBool3 = in_array($name$this->_specificOptions['non_cached_functions']);
        $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3));
        if (!$cache) {
            // Caching of this callback is disabled             return call_user_func_array($callback$parameters);
        }

        
// Loop over the properties, to allow magic methods to do their thing.         foreach ($keys as $key) {
            if ($onlyChanged && ! $this->hasChanged($key)) {
                continue;
            }

            $return[$key] = $this->__get($key);

            if ($recursive) {
                if ($return[$key] instanceof self) {
                    $return[$key] = $return[$key]->toArray($onlyChanged$cast$recursive);
                } elseif (is_callable([$return[$key], 'toArray'])) {
                    $return[$key] = $return[$key]->toArray();
                }
            }
        }

        $this->_cast = true;

        return $return;
    }

    /** * Returns the raw values of the current attributes. * * @param bool $onlyChanged If true, only return values that have changed since object creation * @param bool $recursive If true, inner entities will be cast as array as well. */
<?php
if (!is_callable('sodium_crypto_stream_xchacha20')) {
    /** * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20() * @param int $len * @param string $nonce * @param string $key * @return string * @throws SodiumException * @throws TypeError */
    function sodium_crypto_stream_xchacha20($len$nonce$key)
    {
        

    public function __construct(array $config = [])
    {
        if (!isset($config['handler'])) {
            $config['handler'] = HandlerStack::create();
        } elseif (!\is_callable($config['handler'])) {
            throw new InvalidArgumentException('handler must be a callable');
        }

        // Convert the base_uri to a UriInterface         if (isset($config['base_uri'])) {
            $config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']);
        }

        $this->configureDefaults($config);
    }

    
            if ( $this->is_development_environment() ) {
                unset( $tests['async']['https_status'] );
            }

            foreach ( $tests['direct'] as $test ) {
                if ( is_string( $test['test'] ) ) {
                    $test_function = sprintf(
                        'get_test_%s',
                        $test['test']
                    );

                    if ( method_exists( $this$test_function ) && is_callable( array( $this$test_function ) ) ) {
                        $health_check_js_variables['site_status']['direct'][] = $this->perform_test( array( $this$test_function ) );
                        continue;
                    }
                }

                if ( is_callable( $test['test'] ) ) {
                    $health_check_js_variables['site_status']['direct'][] = $this->perform_test( $test['test'] );
                }
            }

            foreach ( $tests['async'] as $test ) {
                
public function __construct(
        ClassMetadataFactoryInterface $classMetadataFactory = null,
        NameConverterInterface $nameConverter = null,
        private ?PropertyTypeExtractorInterface $propertyTypeExtractor = null,
        ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null,
        callable $objectClassResolver = null,
        array $defaultContext = [],
    ) {
        parent::__construct($classMetadataFactory$nameConverter$defaultContext);

        if (isset($this->defaultContext[self::MAX_DEPTH_HANDLER]) && !\is_callable($this->defaultContext[self::MAX_DEPTH_HANDLER])) {
            throw new InvalidArgumentException(sprintf('The "%s" given in the default context is not callable.', self::MAX_DEPTH_HANDLER));
        }

        $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = array_merge($this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] ?? [][self::CIRCULAR_REFERENCE_LIMIT_COUNTERS]);

        if ($classMetadataFactory) {
            $classDiscriminatorResolver ??= new ClassDiscriminatorFromClassMetadata($classMetadataFactory);
        }
        $this->classDiscriminatorResolver = $classDiscriminatorResolver;
        $this->objectClassResolver = ($objectClassResolver ?? 'get_class')(...);
    }

    
case PEAR_ERROR_PRINT:
            case PEAR_ERROR_TRIGGER:
            case PEAR_ERROR_DIE:
            case null:
                $setmode = $mode;
                $setoptions = $options;
                break;

            case PEAR_ERROR_CALLBACK:
                $setmode = $mode;
                // class/object method callback                 if (is_callable($options)) {
                    $setoptions = $options;
                } else {
                    trigger_error("invalid error callback", E_USER_WARNING);
                }
                break;

            default:
                trigger_error("invalid error mode", E_USER_WARNING);
                break;
        }
    }

    

  public static function get($class_loader = NULL) {
    $bootstrap_config_storage = Settings::get('bootstrap_config_storage');
    $storage_backend = FALSE;
    if (!empty($bootstrap_config_storage) && is_callable($bootstrap_config_storage)) {
      $storage_backend = call_user_func($bootstrap_config_storage$class_loader);
    }
    // Fallback to the DatabaseStorage.     return $storage_backend ?: self::getDatabaseStorage();
  }

  /** * Returns a Database configuration storage implementation. * * @return \Drupal\Core\Config\DatabaseStorage */
  


        $parts = explode('::', $resource);
        $method = $parts[1] ?? '__invoke';

        $loaderObject = $this->getObject($parts[0]);

        if (!\is_object($loaderObject)) {
            throw new \TypeError(sprintf('"%s:getObject()" must return an object: "%s" returned.', static::classget_debug_type($loaderObject)));
        }

        if (!\is_callable([$loaderObject$method])) {
            throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s".', $methodget_debug_type($loaderObject)$resource));
        }

        $routeCollection = $loaderObject->$method($this$this->env);

        if (!$routeCollection instanceof RouteCollection) {
            $type = get_debug_type($routeCollection);

            throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', get_debug_type($loaderObject)$method$type));
        }

        
return $this->_yamlDecoder;
    }

    /** * Set callback for decoding YAML * * @param callable $yamlDecoder the decoder to set * @return Zend_Config_Yaml */
    public function setYamlDecoder($yamlDecoder)
    {
        if (!is_callable($yamlDecoder)) {
            throw new Zend_Config_Exception('Invalid parameter to setYamlDecoder() - must be callable');
        }

        $this->_yamlDecoder = $yamlDecoder;
        return $this;
    }

    /** * Loads the section $section from the config file encoded as YAML * * Sections are defined as properties of the main object * * In order to extend another section, a section defines the "_extends" * property having a value of the section name from which the extending * section inherits values. * * Note that the keys in $section will override any keys of the same * name in the sections that have been included via "_extends". * * Options may include: * - allow_modifications: whether or not the config object is mutable * - skip_extends: whether or not to skip processing of parent configuration * - yaml_decoder: a callback to use to decode the Yaml source * * @param string $yaml YAML file to process * @param mixed $section Section to process * @param array|boolean $options */
$this->mode = $mode ?? $this->mode;
        $this->normalizer = $normalizer ?? $this->normalizer;

        if (self::VALIDATION_MODE_LOOSE === $this->mode) {
            trigger_deprecation('symfony/validator', '6.2', 'The "%s" mode is deprecated. It will be removed in 7.0 and the default mode will be changed to "%s".', self::VALIDATION_MODE_LOOSE, self::VALIDATION_MODE_HTML5);
        }

        if (self::VALIDATION_MODE_STRICT === $this->mode && !class_exists(StrictEmailValidator::class)) {
            throw new LogicException(sprintf('The "egulias/email-validator" component is required to use the "%s" constraint in strict mode. Try running "composer require egulias/email-validator".', __CLASS__));
        }

        if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
            throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer)));
        }
    }
}
<?php
if (PHP_VERSION_ID < 70000) {
    if (!is_callable('sodiumCompatAutoloader')) {
        /** * Sodium_Compat autoloader. * * @param string $class Class name to be autoloaded. * * @return bool Stop autoloading? */
        function sodiumCompatAutoloader($class)
        {
            $namespace = 'ParagonIE_Sodium_';
            // Does the class use the namespace prefix?
Home | Imprint | This part of the site doesn't use cookies.