Create team

@link https://developer.github.com/v3/orgs/teams/#create-team

@param string      $org
@param string      $name
@param null|string $description
@param array       $repoNames
@param string      $permission

@return array
@throws \Exception
977450
public function createTeam(string $org, string $name, string $description = null, array $repoNames = [],
                               string $permission = AbstractApi::PERMISSION_PULL): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org), Request::METHOD_POST, [
                'name'        => $name,
                'description' => $description,
                'repo_names'  => $repoNames,
                'permission'  => $permission
            ]);
    }
908743
public function create($name, $path, $table = null, $create = true)
    {
        $this->ensureMigrationDoesntAlreadyExist($name);

        $path = $this->getPath($name, $path);

        $stub = $this->files->get(__DIR__.'/stubs/create.stub');

        $this->files->put($path, $this->populateStub($name, $stub, $table));

        $this->firePostCreateHooks($table);

        return $path;
    }
1060804
public function setRole($name, $description = null)
    {
        $role = $this->getRole($name) ?: $this->createRole($name);
        if ($description) {
            $role->description = $description;
        }
        $this->add($role);

        return $role;
    }
525584
public function createRole($name, $key = null, $description = null)
    {
        $key        =   snake_case(isset($key) ? $key : $name);
        $description=   isset($description) ? $description : $name;
        $values     =   compact('name', 'key', 'description');

        return $this->roleProvider->create($values);
    }
1100283
public Team createTeam(String name) {
        return connection.execute(new TeamCreate(new Team(name)), apiKey);
    }
369176
private function composeAddColumn($name, array $description)
    {
        $type = strtoupper($description['type']);
        $attributes = $description['attributes'];

        // Transform attributes
        $default = $attributes['default'] ?? null;
        $size = $attributes['size'] ?? false;
        $primary = $attributes['primary'] ?? false;
        $increment = $attributes['increment'] ?? false;
        $nullable = $attributes['nullable'] ?? false;
        $unique = $attributes['unique'] ?? false;
        $check = $attributes['check'] ?? false;

        // String to VARCHAR
        if ($type == 'STRING') {
            $type = 'VARCHAR';

            if (!$size) {
                $size = 255;
            }
        }

        // Add column size
        if ($size) {
            $type = sprintf('%s(%s)', $type, $size);
        }

        // Bind auto increment action
        if ($increment) {
            $type = sprintf('%s AUTO_INCREMENT', $type);
        }

        // Set column as primary key
        if ($primary) {
            $type = sprintf('%s PRIMARY KEY', $type);
        }

        // Set column as unique
        if ($unique) {
            $type = sprintf('%s UNIQUE', $type);
        }

        // Add null or not null
        if ($nullable) {
            $type = sprintf('%s NULL', $type);
        } else {
            $type = sprintf('%s NOT NULL', $type);
        }

        // Add default value
        if ($default) {
            $type = sprintf('%s DEFAULT %s', $type, $default);
        }

        if ($check) {
            $type = sprintf('%s CHECK (%s)', $type, $check);
        }

        return trim(
            sprintf('%s `%s` %s', $description['command'], $name, $type)
        );
    }
667366
private function createNode($name, $entry = null, $entryAttribute = null)
    {
        $document = $this->getDocument();

        try {
            $node = $document->createElement($name);
        } catch (\DOMException $e) {
            $node = $document->createElement($entry ?: $this->entry);

            if (is_string($name)) {
                $node->setAttribute($entryAttribute ?: $this->entryAttribute, $name);
            }
        }

        return $node;
    }
701750
public boolean hasPermission(final Team team, String permissionName) {
        final Query query = pm.newQuery(Permission.class, "name == :permissionName && teams.contains(:team)");
        query.setResult("count(id)");
        return (Long) query.execute(permissionName, team) > 0;
    }
409786
public static function createRole($name, $description)
    {
        // Create role with a given name and description and add it to RBAC system
        $auth = Yii::$app->authManager;
        $role = $auth->createRole($name);
        $role->description = $description;
        $auth->add($role);

        return $role;
    }
1239074
public static function newBlock(string $name, int $permissions = null): vfsStreamBlock
    {
        return new vfsStreamBlock($name, $permissions);
    }
1129374
public function createGroup ($name)
    {
        $json = json_encode([
            'group' => [
                'name' => $name,
            ],
        ]);

        $request = new Request("POST", "https://api.weixin.qq.com/cgi-bin/groups/create", [], $json);
        $response = $this->client->send($request);
        $json = json_decode($response->getBody());
        
        if (isset($json->group->id, $json->group->name)) {
            return new Group($json->group->id, $json->group->name);
        } else {
            throw new Exception("bad response: expected properties `id`, `name`");
        }
    }
965578
public function canAndOwns($permission, $thing, $options = [])
    {
        $options = Helper::checkOrSet('requireAll', $options, [false, true]);
        $options = Helper::checkOrSet('foreignKeyName', $options, [null]);
        $options = Helper::checkOrSet('team', $options, [null]);

        return $this->hasPermission($permission, $options['team'], $options['requireAll'])
                && $this->owns($thing, $options['foreignKeyName']);
    }
429155
public static function &create_new($repo_path, $source = null, $remote_source = false, $reference = null) {
		if (is_dir($repo_path) && file_exists($repo_path."/.git") && is_dir($repo_path."/.git")) {
			throw new \Exception('"'.$repo_path.'" is already a git repository');
		} else {
			$repo = new self($repo_path, true, false);
			if (is_string($source)) {
				if ($remote_source) {
					if (!is_dir($reference) || !is_dir($reference.'/.git')) {
						throw new \Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
					} else if (strlen($reference)) {
						$reference = realpath($reference);
						$reference = "--reference $reference";
					}
					$repo->clone_remote($source, $reference);
				} else {
					$repo->clone_from($source);
				}
			} else {
				$repo->run('init');
			}
			return $repo;
		}
	}
834637
public function create(string $name)
    {
        if ($this->locator->has($name)) {
            return $this->locator->get($name);
        }

        throw new \Exception(\sprintf('Filter "%s" was not found.', $name));
    }
61036
public function createTeamInvite($teamUuid, $email, $roles)
    {
        $options = [
            'form_params' => [
                'email' => $email,
                'roles' => $roles
            ],
        ];

        return new OperationResponse(
            $this->connector->request('post', "/teams/${teamUuid}/invites", $options)
        );
    }
786363
public CmsGroup createGroup(String name, String description) throws Exception {

        return m_cms.createGroup(name, description, I_CmsPrincipal.FLAG_ENABLED, null);
    }
514187
public CompletableFuture<Revision> addPerUserPermission(Author author, String projectName,
                                                            String repoName, User member,
                                                            Collection<Permission> permission) {
        requireNonNull(author, "author");
        requireNonNull(projectName, "projectName");
        requireNonNull(repoName, "repoName");
        requireNonNull(member, "member");
        requireNonNull(permission, "permission");

        return getProject(projectName).thenCompose(project -> {
            ensureProjectMember(project, member);
            return addPermissionAtPointer(author, projectName,
                                          perUserPermissionPointer(repoName, member.id()), permission,
                                          "Add permission of '" + member.id() +
                                          "' as '" + permission + "' to the project " + projectName);
        });
    }