public function addPackage($name, $location = null, $main = null)
    {
        $name = (string)$name;

        if ($name == '') {
            throw new exception\InvalidArgumentException('The require.js package name must not be empty');
        }

        if (!$location && !$main) {
            $this->packages[$name] = $name;
            return $this;
        }

        $this->packages[$name] = [
            'name' => $name,
        ];

        if ($location) {
            $this->packages[$name]['location'] = (string)$location;
        }

        if ($main) {
            $this->packages[$name]['main'] = (string)$main;
        }

        return $this;
    }
public function addPackage($name, $location = null, $main = null)
    {
        $name = (string)$name;

        if ($name == '') {
            throw new exception\InvalidArgumentException('The require.js package name must not be empty');
        }

        if (!$location && !$main) {
            $this->packages[$name] = $name;
            return $this;
        }

        $this->packages[$name] = [
            'name' => $name,
        ];

        if ($location) {
            $this->packages[$name]['location'] = (string)$location;
        }

        if ($main) {
            $this->packages[$name]['main'] = (string)$main;
        }

        return $this;
    }
public function addPackage ( $ name , $ location = null , $ main = null ) { $ name = ( string ) $ name ; if ( $ name == '' ) { throw new exception \ InvalidArgumentException ( 'The require.js package name must not be empty' ) ; } if ( ! $ location && ! $ main ) { $ this -> packages [ $ name ] = $ name ; return $ this ; } $ this -> packages [ $ name ] = [ 'name' => $ name , ] ; if ( $ location ) { $ this -> packages [ $ name ] [ 'location' ] = ( string ) $ location ; } if ( $ main ) { $ this -> packages [ $ name ] [ 'main' ] = ( string ) $ main ; } return $ this ; }
Add a package definition.

If the package is already defined it will be replaced.

@see http://requirejs.org/docs/api.html#packages
@param string $name
@param string $location
@param string $main
Add a package definition .