Prints interfaces that implement an object

@param ReflectionClass $object     class/interface instance
@param array           $interfaces Names of each interface implemented

@return void
964987
protected function writeObjectInterfaces($object, $interfaces)
    {
        foreach ($interfaces as $interfaceName) {
            try {
                $interface   = $this->reflector->getClass($interfaceName);
                $longName    = $interface->getName();

                $this->writeObjectElement($interface);

            } catch (\Exception $e) {
                // interface is undeclared in data source
                $parts       = explode('\\', $interfaceName);
                $shortName   = array_pop($parts);
                $longName    = $interfaceName;
                $ns          = implode($this->namespaceSeparator, $parts);

                if (!isset($this->objects[$ns])) {
                    $this->objects[$ns] = array();
                }

                if (!array_key_exists($shortName, $this->objects[$ns])) {
                    $this->pushObject($ns, $shortName, $longName, 'interface');
                }
            }

            $this->pushEdge(
                array($object->getName(), $longName),
                array('arrowhead' => 'empty', 'style' => 'dashed')
            );
        }
    }
398248
private void readInterfaces() throws IOException {
        // Interfaces
        final int interfaceCount = inputStreamOrByteBuffer.readUnsignedShort();
        for (int i = 0; i < interfaceCount; i++) {
            final String interfaceName = getConstantPoolClassName(inputStreamOrByteBuffer.readUnsignedShort());
            if (implementedInterfaces == null) {
                implementedInterfaces = new ArrayList<>();
            }
            implementedInterfaces.add(interfaceName);
        }
    }
1372240
public function apply(object $object, ReflectionProperty $reflectionProperty, callable $objectCopier): void
    {
        $reflectionProperty->setAccessible(true);
        $reflectionProperty->setValue($object, null);
    }
802769
protected static function printMessage(
        OutputInterface $output,
        $header,
        $body
    ) {
        self::printStructureMessage(
            $output,
            $header,
            $body,
            'line'
        );
    }
214489
protected function projectObject(ObjectInterface $object)
    {
        foreach ($this->getStaticFieldValues($object) as $value) {
            yield $value;
        }

        foreach ($this->getAttributeKeysAndControllers() as list($attributeKey, $attributeController)) {
            /* @var \Concrete\Core\Attribute\AttributeKeyInterface $attributeKey */
            /* @var \Concrete\Core\Attribute\Controller $attributeController */
            $value = $object->getAttributeValueObject($attributeKey, false);
            $attributeController->setAttributeValue($value);
            if ($attributeController instanceof SimpleTextExportableAttributeInterface) {
                yield $attributeController->getAttributeValueTextRepresentation();
            } elseif ($attributeController instanceof MulticolumnTextExportableAttributeInterface) {
                foreach ($attributeController->getAttributeValueTextRepresentation() as $part) {
                    yield $part;
                }
            }
        }
    }
1122622
public function describe(OutputInterface $output, $object, array $options = [])
	{
		$this->output = $output;

		switch (true)
		{
			case $object instanceof Application:
				$this->describeJoomlaApplication($object, $options);

				break;

			case $object instanceof AbstractCommand:
				$this->describeConsoleCommand($object, $options);

				break;

			default:
				parent::describe($output, $object, $options);
		}
	}
716364
private function object($object, string $label = ''): void
    {
        if ($object instanceof PresentationModel) {
            $this->presentationModel($object, $label);
        } elseif ($object instanceof View) {
            $this->view($object);
        } else {
            $this->iterable(get_object_vars($object), $label);
        }
    }
896576
public static function hasInterface($objectOrClass, string $interfaceClassName): bool
    {
        return in_array($interfaceClassName, self::getInterfaces($objectOrClass));
    }
725613
private function handleProperties($data, $object, \ReflectionClass $reflection, $fields)
    {
        foreach ($fields as $field) {
            $property = $reflection->getProperty($field);
            $name     = $property->getName();

            if (property_exists($data, $name) === false ) {
                continue;
            }
            $property->setAccessible(true);
            $type  = $this->propertyHandler->propertyTypeOverride(null, $property);
            $value = $this->propertyHandler->handleTypeConversion($type, $data->$name);

            $property->setValue($object, $value);
        }
    }
1153584
private function printConflictTable(IO $io, array $mappings, $indentation = 0)
    {
        /** @var PathConflict[] $conflicts */
        $conflicts = array();
        $shortPrefix = str_repeat(' ', $indentation);
        $prefix = str_repeat(' ', $indentation + 4);
        $printNewline = false;

        foreach ($mappings as $mapping) {
            foreach ($mapping->getConflicts() as $conflict) {
                $conflicts[spl_object_hash($conflict)] = $conflict;
            }
        }

        foreach ($conflicts as $conflict) {
            if ($printNewline) {
                $io->writeLine('');
            }

            $io->writeLine(sprintf('%sConflicting path: %s', $shortPrefix, $conflict->getRepositoryPath()));
            $io->writeLine('');

            $table = new Table(PuliTableStyle::borderless());

            $table->setHeaderRow(array('Module', 'Puli Path', 'Real Path(s)'));

            foreach ($conflict->getMappings() as $mapping) {
                $table->addRow(array(
                    '<bad>'.$mapping->getContainingModule()->getName().'</bad>',
                    '<bad>'.$mapping->getRepositoryPath().'</bad>',
                    '<bad>'.implode(', ', $mapping->getPathReferences()).'</bad>',
                ));
            }

            $io->writeLine(sprintf('%sMapped by the following mappings:', $prefix));
            $io->writeLine('');

            $table->render($io, $indentation + 4);

            $printNewline = true;
        }
    }
887360
protected static function _generateInterfaceMethods($interfaces, $mask = 255)
    {
        if (!$interfaces) {
            return [];
        }
        $result = [];
        foreach ((array) $interfaces as $interface) {
            if (!interface_exists($interface)) {
                throw new MissingImplementationException("Unexisting interface `{$interface}`");
            }
            $reflection = Inspector::inspect($interface);
            $methods = $reflection->getMethods($mask);
            foreach ($methods as $method) {
                $result[$method->getName()] = static::_generateMethod($method);
            }
        }
        return $result;
    }
854520
public function setOutput(OutputInterface $output)
    {
        $this->output = $output;
        $this->stdErr = $output instanceof ConsoleOutputInterface
            ? $output->getErrorOutput()
            : $output;
    }
1266809
protected function getObjectGetterValues($methods, $object, array &$out = [])
    {
        foreach ($methods as $method) {
            $this->setObjectGetterValue($method, $object, $out);
        }
    }
353693
public function printObject( $object, $offset = 0, $key = NULL, $sign = NULL, $factor = NULL )
	{
		if( is_object( $object ) || gettype( $object ) == "object" )
		{
			extract( self::$channels[$this->channel] );
			$ins_key	= ( $key !== NULL ) ? $key." -> " : "";
			$space		= $this->indentSign( $offset, $sign, $factor );
			echo $space."[O] ".$ins_key."".$highlightOpen.get_class( $object ).$highlightClose.$lineBreak;
			$vars		= get_object_vars( $object );
			foreach( $vars as $key => $value )
			{
				if( is_object( $value ) )
					$this->printObject( $value, $offset + 1, $key, $sign, $factor );
				else if( is_array( $value ) )
					$this->printArray( $value, $offset + 1, $key, $sign, $factor );
				else
					$this->printMixed( $value, $offset + 1, $key, $sign, $factor );
			}
		}
		else
			$this->printMixed( $object, $offset, $key, $sign, $factor );
	}
437423
protected function filterImplements(RefClass $class, array $interfaces)
    {
        if (empty($interfaces)) {
            return true;
        }

        foreach ($interfaces as $interface) {
            $interface = ltrim($interface, '\\');

            if (!in_array($interface, $class->implements, true)) {
                return false;
            }
        }

        return true;
    }
869287
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);
        $plugins = $this
            ->pluginRepository
            ->findAll();

        /**
         * @var Plugin $plugin
         */
        foreach ($plugins as $plugin) {
            $this->printMessage(
                $output,
                'Plugin',
                $plugin->getNamespace() . ' - [Hash : ' . $plugin->getHash() . ']'
            );
        }

        $this->finishCommand($output);
    }
1280485
public static function printIndices(
        InputInterface $input,
        OutputInterface $output,
        array $indices
    ) {
        $hasIndices = !empty($indices);
        $table = new Table($output);
        $headers = ['UUID', 'App ID', 'Doc Count', 'Size', 'Ok?', 'shards', 'replicas'];
        $withMetadata = $input->getOption('with-metadata');
        $withFields = $input->getOption('with-fields');
        if ($hasIndices && $withFields) {
            $headers[] = 'Fields';
        }

        if ($hasIndices && $withMetadata) {
            foreach ($indices[0]->getMetadata() as $field => $_) {
                $headers[] = ucfirst($field);
            }
        }

        $table->setHeaders($headers);

        /*
         * @var Index
         */
        foreach ($indices as $index) {
            $row = [
                $index->getUUID()->composeUUID(),
                $index->getAppUUID()->composeUUID(),
                $index->getDocCount(),
                $index->getSize(),
                $index->isOK()
                    ? 'Yes'
                    : 'No',
                $index->getShards(),
                $index->getReplicas(),
            ];

            if ($withFields) {
                $fields = $index->getFields();
                array_walk($fields, function (string &$type, string $field) {
                    $type = "$field: $type";
                });
                $row[] = implode("\n", $fields);
            }

            if ($withMetadata) {
                foreach ($index->getMetadata() as $_ => $value) {
                    $row[] = $value;
                }
            }

            $table->addRow($row);
        }
        $table->render();
    }