src/Draggy/Loader.php
private function getInterfaces()
    {
        $r = '';

        // Inside interfaces
        foreach ($this->modules as $module) {
            $interfaces = (array)$this->xml->xpath('/draggy/module[@name=\'' . $module . '\']/interface');

            foreach ($interfaces as $interface) {
                $interfaceAttributes = (array)$interface;
                $interfaceAttributes = $interfaceAttributes['@attributes'];

                $this->checkMandatoryAttributes('Interface in module ' . $module, $interfaceAttributes, ['name']);

                $className = $interfaceAttributes['name'];

                $this->checkMandatoryAttributes(
                    'Interface ' . $className . ' in module ' . $module,
                    $interfaceAttributes,
                    ['left', 'top']
                );

                $r .= 'var i = new Interface(\'' . $interfaceAttributes['name'] . '\',\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\');' . PHP_EOL;
                $r .= 'i.moveTo(\'' . ( $interfaceAttributes['left'] /*- 1*/ ) . 'px\',\'' . ( $interfaceAttributes['top'] /*- 1*/ ) . 'px\');' . PHP_EOL;

                $r .= $this->getInterfaceProperties($interfaceAttributes, 'i');

                $r .= 'i.setModule(Container.prototype.getContainerByName(\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\').getId());' . PHP_EOL;
            }
        }

        // Outside interfaces
        $interfaces = (array)$this->xml->xpath('/draggy/loose/interface');

        foreach ($interfaces as $interface) {
            $interfaceAttributes = (array)$interface;
            $interfaceAttributes = $interfaceAttributes['@attributes'];

            $this->checkMandatoryAttributes('Loose interface', $interfaceAttributes, ['name']);

            $className = $interfaceAttributes['name'];

            $this->checkMandatoryAttributes('Loose interface ' . $className, $interfaceAttributes, ['left', 'top']);

            $r .= 'var i = new Interface(\'' . $className . '\');' . PHP_EOL;
            $r .= 'i.moveTo(\'' . ( $interfaceAttributes['left'] ) . 'px\',\'' . ( $interfaceAttributes['top'] ) . 'px\');' . PHP_EOL;

            $r .= $this->getInterfaceProperties($interfaceAttributes, 'i');
        }

        return $r;
    }
private function getInterfaces()
    {
        $r = '';

        // Inside interfaces
        foreach ($this->modules as $module) {
            $interfaces = (array)$this->xml->xpath('/draggy/module[@name=\'' . $module . '\']/interface');

            foreach ($interfaces as $interface) {
                $interfaceAttributes = (array)$interface;
                $interfaceAttributes = $interfaceAttributes['@attributes'];

                $this->checkMandatoryAttributes('Interface in module ' . $module, $interfaceAttributes, ['name']);

                $className = $interfaceAttributes['name'];

                $this->checkMandatoryAttributes(
                    'Interface ' . $className . ' in module ' . $module,
                    $interfaceAttributes,
                    ['left', 'top']
                );

                $r .= 'var i = new Interface(\'' . $interfaceAttributes['name'] . '\',\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\');' . PHP_EOL;
                $r .= 'i.moveTo(\'' . ( $interfaceAttributes['left'] /*- 1*/ ) . 'px\',\'' . ( $interfaceAttributes['top'] /*- 1*/ ) . 'px\');' . PHP_EOL;

                $r .= $this->getInterfaceProperties($interfaceAttributes, 'i');

                $r .= 'i.setModule(Container.prototype.getContainerByName(\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\').getId());' . PHP_EOL;
            }
        }

        // Outside interfaces
        $interfaces = (array)$this->xml->xpath('/draggy/loose/interface');

        foreach ($interfaces as $interface) {
            $interfaceAttributes = (array)$interface;
            $interfaceAttributes = $interfaceAttributes['@attributes'];

            $this->checkMandatoryAttributes('Loose interface', $interfaceAttributes, ['name']);

            $className = $interfaceAttributes['name'];

            $this->checkMandatoryAttributes('Loose interface ' . $className, $interfaceAttributes, ['left', 'top']);

            $r .= 'var i = new Interface(\'' . $className . '\');' . PHP_EOL;
            $r .= 'i.moveTo(\'' . ( $interfaceAttributes['left'] ) . 'px\',\'' . ( $interfaceAttributes['top'] ) . 'px\');' . PHP_EOL;

            $r .= $this->getInterfaceProperties($interfaceAttributes, 'i');
        }

        return $r;
    }
private function getInterfaces ( ) { $ r = '' ; // Inside interfaces foreach ( $ this -> modules as $ module ) { $ interfaces = ( array ) $ this -> xml -> xpath ( '/draggy/module[@name=\'' . $ module . '\']/interface' ) ; foreach ( $ interfaces as $ interface ) { $ interfaceAttributes = ( array ) $ interface ; $ interfaceAttributes = $ interfaceAttributes [ '@attributes' ] ; $ this -> checkMandatoryAttributes ( 'Interface in module ' . $ module , $ interfaceAttributes , [ 'name' ] ) ; $ className = $ interfaceAttributes [ 'name' ] ; $ this -> checkMandatoryAttributes ( 'Interface ' . $ className . ' in module ' . $ module , $ interfaceAttributes , [ 'left' , 'top' ] ) ; $ r .= 'var i = new Interface(\'' . $ interfaceAttributes [ 'name' ] . '\',\'' . str_replace ( '\\' , '\\\\' , $ module ) . '\');' . PHP_EOL ; $ r .= 'i.moveTo(\'' . ( $ interfaceAttributes [ 'left' ] /*- 1*/ ) . 'px\',\'' . ( $ interfaceAttributes [ 'top' ] /*- 1*/ ) . 'px\');' . PHP_EOL ; $ r .= $ this -> getInterfaceProperties ( $ interfaceAttributes , 'i' ) ; $ r .= 'i.setModule(Container.prototype.getContainerByName(\'' . str_replace ( '\\' , '\\\\' , $ module ) . '\').getId());' . PHP_EOL ; } } // Outside interfaces $ interfaces = ( array ) $ this -> xml -> xpath ( '/draggy/loose/interface' ) ; foreach ( $ interfaces as $ interface ) { $ interfaceAttributes = ( array ) $ interface ; $ interfaceAttributes = $ interfaceAttributes [ '@attributes' ] ; $ this -> checkMandatoryAttributes ( 'Loose interface' , $ interfaceAttributes , [ 'name' ] ) ; $ className = $ interfaceAttributes [ 'name' ] ; $ this -> checkMandatoryAttributes ( 'Loose interface ' . $ className , $ interfaceAttributes , [ 'left' , 'top' ] ) ; $ r .= 'var i = new Interface(\'' . $ className . '\');' . PHP_EOL ; $ r .= 'i.moveTo(\'' . ( $ interfaceAttributes [ 'left' ] ) . 'px\',\'' . ( $ interfaceAttributes [ 'top' ] ) . 'px\');' . PHP_EOL ; $ r .= $ this -> getInterfaceProperties ( $ interfaceAttributes , 'i' ) ; } return $ r ; }
Get the project interfaces

@return string
Get the project interfaces