lib/Github/Api/GitData/Trees.php
public function create($username, $repository, array $params)
    {
        if (!isset($params['tree']) || !is_array($params['tree'])) {
            throw new MissingArgumentException('tree');
        }

        if (!isset($params['tree'][0])) {
            $params['tree'] = [$params['tree']];
        }

        foreach ($params['tree'] as $key => $tree) {
            if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
                throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
            }

            // If `sha` is not set, `content` is required
            if (!isset($tree['sha']) && !isset($tree['content'])) {
                throw new MissingArgumentException("tree.$key.content");
            }
        }

        return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
    }
public function create($username, $repository, array $params)
    {
        if (!isset($params['tree']) || !is_array($params['tree'])) {
            throw new MissingArgumentException('tree');
        }

        if (!isset($params['tree'][0])) {
            $params['tree'] = [$params['tree']];
        }

        foreach ($params['tree'] as $key => $tree) {
            if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
                throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
            }

            // If `sha` is not set, `content` is required
            if (!isset($tree['sha']) && !isset($tree['content'])) {
                throw new MissingArgumentException("tree.$key.content");
            }
        }

        return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
    }
public function create ( $ username , $ repository , array $ params ) { if ( ! isset ( $ params [ 'tree' ] ) || ! is_array ( $ params [ 'tree' ] ) ) { throw new MissingArgumentException ( 'tree' ) ; } if ( ! isset ( $ params [ 'tree' ] [ 0 ] ) ) { $ params [ 'tree' ] = [ $ params [ 'tree' ] ] ; } foreach ( $ params [ 'tree' ] as $ key => $ tree ) { if ( ! isset ( $ tree [ 'path' ] , $ tree [ 'mode' ] , $ tree [ 'type' ] ) ) { throw new MissingArgumentException ( [ "tree.$key.path" , "tree.$key.mode" , "tree.$key.type" ] ) ; } // If `sha` is not set, `content` is required if ( ! isset ( $ tree [ 'sha' ] ) && ! isset ( $ tree [ 'content' ] ) ) { throw new MissingArgumentException ( "tree.$key.content" ) ; } } return $ this -> post ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/git/trees' , $ params ) ; }
Create tree for a repository.

@param string $username
@param string $repository
@param array  $params

@throws \Github\Exception\MissingArgumentException

@return array
Create tree for a repository .