Get the palette properties their are visible and editable.

@param PaletteInterface $palette The palette.
@param ModelInterface   $model   The model.

@return array
18369
private function getVisibleAndEditAbleProperties(PaletteInterface $palette, ModelInterface $model)
    {
        return \array_intersect(
            \array_map(
                function (PropertyInterface $property) {
                    return $property->getName();
                },
                $palette->getVisibleProperties($model)
            ),
            \array_map(
                function (PropertyInterface $property) {
                    return $property->getName();
                },
                $palette->getEditableProperties($model)
            )
        );
    }
1008522
protected function getTimestampFields($model)
    {
        try {
            $baseModel = new ReflectionClass($model);
            $timestampFields = [
                'created_at' => $baseModel->getConstant('CREATED_AT'),
                'updated_at' => $baseModel->getConstant('UPDATED_AT'),
                'deleted_at' => $baseModel->getConstant('DELETED_AT'),
            ];
        } catch (Exception $e) {
            echo 'baseModel: '.$model.' not found'.LF;
            $timestampFields = [
                'created_at' => 'created_at',
                'updated_at' => 'updated_at',
                'deleted_at' => 'deleted_at',
            ];
        }

        return $timestampFields;
    }
582715
public function getRelationships($model): iterable
    {
        assert($model instanceof ModelInterface);

        foreach ($this->getRelationshipsMapping() as $jsonRelName => [$modelRelName, $belongsToFkName, $reverseType]) {
            // if model has relationship data then use it
            if ($this->hasProperty($model, $modelRelName) === true) {
                yield $jsonRelName => $this->createRelationshipRepresentationFromData(
                    $model,
                    $modelRelName,
                    $jsonRelName
                );
                continue;
            }

            // if relationship is `belongs-to` and has that ID we can add relationship as identifier
            if ($belongsToFkName !== null && $this->hasProperty($model, $belongsToFkName) === true) {
                $reverseIndex = $model->{$belongsToFkName};
                $identifier   = $reverseIndex === null ?
                    null : new Identifier((string)$reverseIndex, $reverseType, false, null);

                yield $jsonRelName => [
                    static::RELATIONSHIP_DATA       => $identifier,
                    static::RELATIONSHIP_LINKS_SELF => $this->isAddSelfLinkInRelationshipWithData($jsonRelName),
                ];
                continue;
            }

            // if we are here it's nothing left but show relationship as a link
            yield $jsonRelName => [static::RELATIONSHIP_LINKS_SELF => true];
        }
    }
848929
protected function getModelPermissions($model)
    {
        $tree = $this->treeBuilder->getTree();
        $psrClass = '';
        if (is_string($model)) {
            $psrClass = $model;
        } elseif (is_object($model)) {
            $psrClass = get_class($model);
        }

        if (!empty($tree['models']) && array_key_exists($psrClass, $tree['models'])) {
            return $tree['models'][$psrClass];
        }

        return [];
    }
930444
private function getPropertyTypes(ObjectInterface $object, $index)
    {
        $objectClass = get_class($object);

        if (!array_key_exists($objectClass, $this->reflectionCache) || !array_key_exists($index,
                $this->reflectionCache[$objectClass])) {

            $propertyTypes = $this->PropertyInfoExtractor->getTypes($objectClass, $index);

            $this->reflectionCache[$objectClass][$index] = $propertyTypes;
        } else {
            $propertyTypes = $this->reflectionCache[$objectClass][$index];
        }

        return $propertyTypes;
    }
860460
protected function _getOptionsFromModel($model)
    {
        $model = TableRegistry::get($model);

        if (method_exists($model, 'postType')) {
            $result = $model->postType();
            if ($result) {
                $result['table'] = $model->table();
            }
            return $result;
        }
        if (property_exists($model, 'postType')) {
            $result = $model->postType;
            if ($result) {
                $result['table'] = $model->table();
            }
            return $result;
        }
        return [];
    }
838261
protected function parsePalettes(ContainerInterface $container)
    {
        $palettesDefinitionArray    = $this->getFromDca('palettes');
        $subPalettesDefinitionArray = $this->getFromDca('subpalettes');

        // Skip while there is no legacy palette definition.
        if (!\is_array($palettesDefinitionArray)) {
            return;
        }

        // Ignore non-legacy sub palette definition.
        if (!\is_array($subPalettesDefinitionArray)) {
            $subPalettesDefinitionArray = [];
        }

        if ($container->hasDefinition(PalettesDefinitionInterface::NAME)) {
            $palettesDefinition = $container->getDefinition(PalettesDefinitionInterface::NAME);
        } else {
            $palettesDefinition = new DefaultPalettesDefinition();
            $container->setDefinition(PalettesDefinitionInterface::NAME, $palettesDefinition);
        }

        $palettesParser = new LegacyPalettesParser();
        $palettesParser->parse(
            $palettesDefinitionArray,
            $subPalettesDefinitionArray,
            $palettesDefinition
        );
    }
1337893
private static function _readColor($color,$palette,$version)
	{
		if ($color <= 0x07 || $color >= 0x40) {
			// special built-in color
			return self::_mapBuiltInColor($color);
		} elseif (isset($palette) && isset($palette[$color - 8])) {
			// palette color, color index 0x08 maps to pallete index 0
			return $palette[$color - 8];
		} else {
			// default color table
			if ($version == self::XLS_BIFF8) {
				return self::_mapColor($color);
			} else {
				// BIFF5
				return self::_mapColorBIFF5($color);
			}
		}

		return $color;
	}
351080
protected function showRelatoins(Model $model)
    {
        $name = $this->manager->getClassName($model);

        $this->title("Relations of Model {$name}: ");

        $relations = $this->manager->getRelations($model);
        $tbody = [];

        foreach ($relations as $relation) {
            $relationName = $this->manager->getClassName($relation);
            $related = $relation->getRelated() ?:null;

            $tbody[] = [
                $this->paintString($relationName, 'brown'),
                $related ? $this->manager->getClassName($related) : '',
            ];
        }

        $this->table(['relation', 'model'], $tbody);
    }
489097
public function getColorPalette($image, $colorCount, $quality, $colorValue)
    {
        try {
            $source = new LocalSourceImageModel($image);
            $source->getLocalCopy();
        } catch (ImagerException $e) {
            return null;
        }

        $palette = ColorThief::getPalette($source->getFilePath(), $colorCount, $quality);

        ImagerService::cleanSession();

        return $colorValue === 'hex' ? $this->paletteToHex($palette) : $palette;
    }
335094
public function setPaletteCollectionClassName($paletteCollectionClassName)
    {
        $event = new SetPaletteCollectionClassNameEvent($paletteCollectionClassName, $this);
        $this->dispatchEvent($event);
        $paletteCollectionClassName = $event->getPaletteCollectionClassName();

        $this->paletteCollectionClassName = (string) $paletteCollectionClassName;
        $this->paletteCollectionClass     = new \ReflectionClass($this->paletteCollectionClassName);
        return $this;
    }
362759
public function usePalette(PaletteInterface $palette)
    {
        if ($this->palette) {
            $this->finishPalette();
        }

        $event = new UsePaletteEvent($palette, $this);
        $this->dispatchEvent($event);
        $this->palette = $palette;

        return $this;
    }
1352193
protected function getBlameableFields(Model $model)
    {
        if (isset($this->fields)) {
            return $this->fields;
        }

        $this->fields = self::findBlameableFields($model);

        return $this->fields;
    }
1052821
protected function getAttributes(Blueprint\BlueprintInterface $blueprint)
    {
        return [
            'type' => $blueprint::getType(),
            'from_user_id' => ($fromUser = $blueprint->getFromUser()) ? $fromUser->id : null,
            'subject_id' => ($subject = $blueprint->getSubject()) ? $subject->id : null,
            'data' => ($data = $blueprint->getData()) ? json_encode($data) : null
        ];
    }
88865
private void applyPalette(Palette palette, ViewGroup viewGroup){
        int bgColor = getBackgroundColor(palette);
        if (bgColor != -1)
            viewGroup.setBackgroundColor(bgColor);
    }
454196
private function excludePaletteSelectorProperty(
        Action $action,
        PropertyInterface $property,
        EnvironmentInterface $environment
    ) {
        $palettesDefinition = $environment->getDataDefinition()->getPalettesDefinition();

        if (1 === \count($palettesDefinition->getPalettes())) {
            return false;
        }

        return $this->analyzeExcludeProperty($action, $environment, $property, $palettesDefinition);
    }
1257132
public function getCampaignPalette(NodeInterface $node) {
    $palette = [];
    $campaign = $this->getNodeCampaignNode($node);
    $scheme_id = $campaign->get('field_campaign_palette')->getString();
    $color_info = color_get_info(OPENY_THEME);
    if (!empty($color_info['schemes'][$scheme_id])) {
      $palette = $color_info['schemes'][$scheme_id];
    }
    return $palette;
  }