property_exists example

// If it contains `,`, it has multiple tables         if (is_string($tableName) && strpos($tableName, ',') === false) {
            $this->tableName = $tableName;  // @TODO remove alias if exists         } else {
            $this->tableName = '';
        }

        $this->from($tableName);

        if (empty($options)) {
            foreach ($options as $key => $value) {
                if (property_exists($this$key)) {
                    $this->{$key} = $value;
                }
            }
        }
    }

    /** * Returns the current database connection * * @return BaseConnection|ConnectionInterface */
    
$registry = new TestManagerRegistry('name', []['defaultManager' => 'foo'], 'defaultConnection', 'defaultManager', 'proxyInterfaceName');
        $registry->setTestContainer($container);

        $foo = $container->get('foo');
        $foo->bar = 123;
        $this->assertTrue(isset($foo->bar));

        $registry->resetManager();

        $this->assertSame($foo$container->get('foo'));
        $this->assertInstanceOf(\stdClass::class$foo);
        $this->assertFalse(property_exists($foo, 'bar'));
    }

    /** * When performing an entity manager lazy service reset, the reset operations may re-use the container * to create a "fresh" service: when doing so, it can happen that the "fresh" service is itself a proxy. * * Because of that, the proxy will be populated with a wrapped value that is itself a proxy: repeating * the reset operation keeps increasing this nesting until the application eventually runs into stack * overflow or memory overflow operations, which can happen for long-running processes that rely on * services that are reset very often. */
    

class PropertyMetadata extends MemberMetadata
{
    /** * @param string $class The class this property is defined on * @param string $name The name of this property * * @throws ValidatorException */
    public function __construct(string $class, string $name)
    {
        if (!property_exists($class$name)) {
            throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $name$class));
        }

        parent::__construct($class$name$name);
    }

    public function getPropertyValue(mixed $object): mixed
    {
        $reflProperty = $this->getReflectionMember($object);

        if ($reflProperty->hasType() && !$reflProperty->isInitialized($object)) {
            

function wp_has_border_feature_support( $block_type$feature$default_value = false ) {
    // Check if all border support features have been opted into via `"__experimentalBorder": true`.     if (
        property_exists( $block_type, 'supports' ) &&
        ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' )$default_value ) )
    ) {
        return true;
    }

    // Check if the specific feature has been opted into individually     // via nested flag under `__experimentalBorder`.     return block_has_support( $block_type, array( '__experimentalBorder', $feature )$default_value );
}

// Register the block support.
/** * Gets any arbitrary property for the component. * * @param string $property * The property to retrieve. * * @return mixed * The value for that property, or NULL if the property does not exist. */
  public function get($property) {
    if (property_exists($this$property)) {
      $value = $this->{$property} ?? NULL;
    }
    else {
      $value = $this->additional[$property] ?? NULL;
    }
    return $value;
  }

  /** * Sets a value to an arbitrary property for the component. * * @param string $property * The property to use for the value. * @param mixed $value * The value to set. * * @return $this */

class PropertyMetadata extends MemberMetadata
{
    /** * @param string $class The class this property is defined on * @param string $name The name of this property * * @throws ValidatorException */
    public function __construct(string $class, string $name)
    {
        if (!property_exists($class$name)) {
            throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $name$class));
        }

        parent::__construct($class$name$name);
    }

    public function getPropertyValue(mixed $object): mixed
    {
        $reflProperty = $this->getReflectionMember($object);

        if ($reflProperty->hasType() && !$reflProperty->isInitialized($object)) {
            
private function loadModule(string $name): void
    {
        if ($name === 'sSystem') {
            $this->modules_container[$name] = $this->system;

            return;
        }

        Shopware()->Hooks()->setAlias($name$name);
        $proxy = Shopware()->Hooks()->getProxy($name);
        $this->modules_container[$name] = new $proxy();
        if (property_exists($this->modules_container[$name], 'sSYSTEM')) {
            $this->modules_container[$name]->sSYSTEM = $this->system;
        }
    }
}


    /** * Registers the block attributes required by the different block supports. * * @since 5.6.0 */
    private function register_attributes() {
        $block_registry         = WP_Block_Type_Registry::get_instance();
        $registered_block_types = $block_registry->get_all_registered();
        foreach ( $registered_block_types as $block_type ) {
            if ( ! property_exists( $block_type, 'supports' ) ) {
                continue;
            }
            if ( ! $block_type->attributes ) {
                $block_type->attributes = array();
            }

            foreach ( $this->block_supports as $block_support_config ) {
                if ( ! isset( $block_support_config['register_attribute'] ) ) {
                    continue;
                }

                
/** * Registers the style and colors block attributes for block types that support it. * * @since 5.6.0 * @since 6.1.0 Improved $color_support assignment optimization. * @access private * * @param WP_Block_Type $block_type Block Type. */
function wp_register_colors_support( $block_type ) {
    $color_support                 = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( 'color' ), false ) : false;
    $has_text_colors_support       = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
    $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
    $has_gradients_support         = _wp_array_get( $color_support, array( 'gradients' ), false );
    $has_link_colors_support       = _wp_array_get( $color_support, array( 'link' ), false );
    $has_color_support             = $has_text_colors_support ||
        $has_background_colors_support ||
        $has_gradients_support ||
        $has_link_colors_support;

    if ( ! $block_type->attributes ) {
        $block_type->attributes = array();
    }
/** * Create test views from config. * * @param string $class * The name of the test class. Installs the listed test views *in order*. * @param array $modules * The module directories to look in for test views. */
  public static function createTestViews($class, array $modules) {
    $views = [];
    while ($class) {
      if (property_exists($class, 'testViews')) {
        $views = array_merge($views$class::$testViews);
      }
      $class = get_parent_class($class);
    }
    if (!empty($views)) {
      $storage = \Drupal::entityTypeManager()->getStorage('view');
      $module_handler = \Drupal::moduleHandler();
      foreach ($modules as $module) {
        $config_dir = \Drupal::service('extension.list.module')->getPath($module) . '/test_views';
        if (!is_dir($config_dir) || !$module_handler->moduleExists($module)) {
          continue;
        }
/** * Gets the config schema exclusions for this test. * * @return string[] * An array of config object names that are excluded from schema checking. */
  protected function getConfigSchemaExclusions() {
    $class = static::class;
    $exceptions = [];
    while ($class) {
      if (property_exists($class, 'configSchemaCheckerExclusions')) {
        $exceptions = array_merge($exceptions$class::$configSchemaCheckerExclusions);
      }
      $class = get_parent_class($class);
    }
    // Filter out any duplicates.     return array_unique($exceptions);
  }

  /** * {@inheritdoc} */
  

    private function createConfigFromArray(string $classname, array $config)
    {
        $configObj = new $classname();

        foreach ($config as $key => $value) {
            if (property_exists($configObj$key)) {
                $configObj->{$key} = $value;

                continue;
            }

            throw new LogicException(
                'No such property: ' . $classname . '::$' . $key
            );
        }

        return $configObj;
    }

    public function initialize($config)
    {
        $this->clear();

        if ($config instanceof \Config\Email) {
            $config = get_object_vars($config);
        }

        foreach (array_keys(get_class_vars(static::class)) as $key) {
            if (property_exists($this$key) && isset($config[$key])) {
                $method = 'set' . ucfirst($key);

                if (method_exists($this$method)) {
                    $this->{$method}($config[$key]);
                } else {
                    $this->{$key} = $config[$key];
                }
            }
        }

        $this->charset  = strtoupper($this->charset);
        
if (!$properties = $this->listExtractor->getProperties($className)) {
            return false;
        }

        $loaded = false;
        $enabledForClass = $this->isAutoMappingEnabledForClass($metadata$this->classValidatorRegexp);
        foreach ($properties as $property) {
            if (false === $this->accessExtractor->isWritable($className$property)) {
                continue;
            }

            if (!property_exists($className$property)) {
                continue;
            }

            $types = $this->typeExtractor->getTypes($className$property);
            if (null === $types) {
                continue;
            }

            $enabledForProperty = $enabledForClass;
            $hasTypeConstraint = false;
            $hasNotNullConstraint = false;
            
/** * Registers the style and typography block attributes for block types that support it. * * @since 5.6.0 * @since 6.3.0 Added support for text-columns. * @access private * * @param WP_Block_Type $block_type Block Type. */
function wp_register_typography_support( $block_type ) {
    if ( ! property_exists( $block_type, 'supports' ) ) {
        return;
    }

    $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false );
    if ( ! $typography_supports ) {
        return;
    }

    $has_font_family_support     = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );
    $has_font_size_support       = _wp_array_get( $typography_supports, array( 'fontSize' ), false );
    $has_font_style_support      = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );
    
Home | Imprint | This part of the site doesn't use cookies.