src/Command/Metadata.php
/**
     * $input and $output will generally be used from the getters, and were set in initialize.
     * they are still in the signature as required by the Command parent class
     */
$input and $output will generally be used from the getters, and were set in initialize.
they are still in the signature as required by the Command parent class
$input and $output will generally be used from the getters and were set in initialize . they are still in the signature as required by the Command parent class
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->phretsLogin();
        foreach ($this->getResourcesAndClasses()[self::KEY_CLASSES] as $class) {
            $resource = $this->getResourcesAndClasses()[self::KEY_RESOURCE];
            $output->writeln('Resource: ' . $resource);
            $output->writeln('Class: ' . $class);
            $dataOutput = $this->getOutputStrategy();
            if ($dataOutput !== null) {
                $dataOutput->setMlsKey($input->getArgument(self::ARGUMENT_KEY))
                    ->setResourceName($resource)
                    ->setClassName($class)
                    ->setTypeName($input->getArgument(self::ARGUMENT_TYPE));
            }
            switch ($input->getArgument(self::ARGUMENT_TYPE)) {
                case 'system':
                    $results = $this->buildSystemMetadata();
                    break;
                case 'resources':
                    $results = $this->buildResourcesMetadata($resource);
                    break;
                case 'classes':
                    $results = $this->buildClassesMetadata($resource);
                    break;
                case 'table':
                    $results = $this->buildTableMetadata($resource, $class);
                    $this->sortTableResults($results);
                    break;
                default:
                    throw new \RuntimeException(
                        sprintf(
                            "Invalid metadata type provided: '%s'. Must be one of : %s",
                            $input->getArgument(self::ARGUMENT_TYPE),
                            implode(', ', self::METADATA_TYPES)
                        )
                    );
            }
            if ($dataOutput !== null) {
                $dataOutput->outputResults($results);
            } else {
                $output->write(var_export($results, true));
            }
            if ($dataOutput !== null) {
                $dataOutput->complete();
            }
            $output->writeln('');
        }
        $this->getPhretsSession()->Disconnect();
        return Command::SUCCESS;
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> phretsLogin ( ) ; foreach ( $ this -> getResourcesAndClasses ( ) [ self :: KEY_CLASSES ] as $ class ) { $ resource = $ this -> getResourcesAndClasses ( ) [ self :: KEY_RESOURCE ] ; $ output -> writeln ( 'Resource: ' . $ resource ) ; $ output -> writeln ( 'Class: ' . $ class ) ; $ dataOutput = $ this -> getOutputStrategy ( ) ; if ( $ dataOutput !== null ) { $ dataOutput -> setMlsKey ( $ input -> getArgument ( self :: ARGUMENT_KEY ) ) -> setResourceName ( $ resource ) -> setClassName ( $ class ) -> setTypeName ( $ input -> getArgument ( self :: ARGUMENT_TYPE ) ) ; } switch ( $ input -> getArgument ( self :: ARGUMENT_TYPE ) ) { case 'system' : $ results = $ this -> buildSystemMetadata ( ) ; break ; case 'resources' : $ results = $ this -> buildResourcesMetadata ( $ resource ) ; break ; case 'classes' : $ results = $ this -> buildClassesMetadata ( $ resource ) ; break ; case 'table' : $ results = $ this -> buildTableMetadata ( $ resource , $ class ) ; $ this -> sortTableResults ( $ results ) ; break ; default : throw new \ RuntimeException ( sprintf ( " Invalid metadata type provided: '%s'. Must be one of : %s " , $ input -> getArgument ( self :: ARGUMENT_TYPE ) , implode ( ', ' , self :: METADATA_TYPES ) ) ) ; } if ( $ dataOutput !== null ) { $ dataOutput -> outputResults ( $ results ) ; } else { $ output -> write ( var_export ( $ results , true ) ) ; } if ( $ dataOutput !== null ) { $ dataOutput -> complete ( ) ; } $ output -> writeln ( '' ) ; } $ this -> getPhretsSession ( ) -> Disconnect ( ) ; return Command :: SUCCESS ; }
$input and $output will generally be used from the getters, and were set in initialize.
$input and $output will generally be used from the getters and were set in initialize .
// @todo this is resource+class-independent, no need to loop over those, nor include them in the filename. should also warn that those configs/params are ignored. // @todo this is class-independent, no need to loop over those, nor include them in the filename. should also warn that those configs/params are ignored. // @todo this is class-independent, no need to loop over those, nor include them in the filename. should also warn that those configs/params are ignored.