@link https://developer.github.com/v3/repos/traffic/#clones

@param string $owner
@param string $repository
@param string $per

@return array
174606
public function clones($owner, $repository, $per = 'day')
    {
        return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/clones?per='.rawurlencode($per));
    }
191475
public function tocAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        $twigAnalyzer = $this->get('opifer.content.twig_analyzer');

        $parameters = [
            'environment' => $environment,
            'analyzer' => $twigAnalyzer,
            'object' => $environment->getObject(),
        ];

        return $this->render('OpiferContentBundle:Content:toc.html.twig', $parameters);
    }
1155232
public function update(Repository $repository = null)
    {
        if (!$repository) {
            $repository = $this->getRepository();
        }

        $repository = $repository->aliased('write');

        $update = $this->getQuery()->transformToUpdate();

        $update->setSet($this->setData);

        $prepare = $repository->prepareQuery($update);

        return $repository->executePrepared($prepare);
    }
541504
private function getRelations(Repository $repository, array $relations = [])
    {
        // if we have relation array passed, ignore request input
        if (count($relations) === 0) {
            $relations = Input::get('with');

            if (!is_array($relations)) {
                $relations = $this->inputService->decode('with');
            }
        }

        $result = [];
        $repo_relations = $repository->relations();
        foreach ($relations as $key => $value) {
            if (in_array($key, $repo_relations)) {
                $result[] = $key;
            } elseif (in_array($value, $repo_relations)) {
                $result[] = $value;
            }
        }

        return $result;
    }
621564
protected function getModules(Repository $repository)
    {
        $modules = $repository->all();
        $results = [];

        foreach ($modules as $module) {
            $results[] = $this->getModuleInformation($repository, $module);
        }

        return array_filter($results);
    }
279402
private function cloneByRepositoryUrl($args)
    {
        $repositoryUrl = $args[0];
        $projectName = isset($args[1]) ? $args[1] : $this->getProjectNameByRepositoryUrl($repositoryUrl);

        if (!$this->existsRepositoryUrl($repositoryUrl)) {
            return 'Repository url not exists!';
        }

        if ($this->existsProjectName($projectName)) {
            return "> Producer: Project '{$this->projectsDir}/{$projectName}' already exists during clone.\n";
        }

        $this->info("Clone by repository url '{$repositoryUrl}'");
        $this->exec('clone', 'clone-by-repository-url', [$repositoryUrl, $projectName]);

        if ($this->noMount) {
            return;
        }

        $packageName = $this->getProjectPackageName($projectName, $repositoryUrl);

        if (!$this->existsPackageName($packageName)) {
            return $this->exec('clone', 'mount-unknown-package-as-project', [$packageName, $projectName]);
        }

        if (!$this->existsRootComposerJson()) {
            $this->createRootComposerJson();
        }

        return $this->exec('clone', 'mount-require-package-as-project', [$packageName, $projectName]);
    }
1097255
public function withOwner($owner, callable $callback, $args = [])
    {
        try {
            $this->setOwner($owner);
            return $callback(...$args);
        } finally {
            $this->clearOwner();
        }
    }
527024
public function listLabelsOnAnIssue($owner, $repo, $number)
	{
		$data = array();
		
		return $this->client->request("/repos/$owner/$repo/issues/$number/labels", 'GET', $data, 200, 'GitHubLabel', true);
	}
1354673
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->authServer->getGrantType('authorization_code')->newAuthoriseRequest($owner, $owner_id, $options);
  }
145465
public function makeChangelog($repository) {
      $repoPrefix = 'remotes/upstream/';
      $parentRevision = 'master';
      $currentRevision = 'develop';

      $changelog = $this->taskChangelog();
      $command = 'git describe --abbrev=0 --tags';
      $lastTag = $this->_exec($command)->getMessage();
      if ($lastTag) {
         // if tags exist check against the last one
         $parentRevision = 'tags/' . trim($lastTag);
      } else if (!$this->_exec("git ls-remote upstream $parentRevision")->getMessage()) {
         // master branch does not exist, let's go against first parent as first time ever revision check
         $message = $this->_exec("git rev-list --max-parents=0 HEAD")->getMessage();
         $parentRevision = trim($message);
         $currentRevision = 'HEAD';
      }

      // default revision range
      $fromRev = $repoPrefix . $parentRevision;
      $toRev = $repoPrefix . $currentRevision;
      if ($currentRevision == 'HEAD') {
         // first time ever revision check fix, prefix can't be used.
         $fromRev = $parentRevision;
         $toRev = $currentRevision;
      }

      $this->stopOnFail(true);
      $command = 'git log --pretty=" * %s ([%h](https://github.com/' . $repository . '/commit/%h))"  ' . $fromRev . '..' . $toRev . ' --grep="^fix" --grep="^feat" --grep=="^perf"';
      $result = $this->_exec($command)->getMessage();
      if (empty($result)) {
         return Robo\Result::cancelled('No new commits for release an update');
      }
      if (preg_match('/(BREAKING CHANGE:)|(^ \* feat)/m', $result, $regs)) {
         switch ($regs[0]) {
            case 'BREAKING CHANGE:':
               $this->releaseType = 'major';
               break;
            case ' * feat':
               $this->releaseType = 'minor';
               break;
            // by default is patch
         }
      }
      $this->setVersionFromComposer('composer.json');
      $newVersion = $this->newVersion = $this->generateNextVersion($this->version);
      $result = ($result) ? $result : ' * Minor changes, for more details see our [commit history](https://github.com/' . $repository . '/compare/master...' . $newVersion . '/bugfixes)';
      $changelog->filename('CHANGELOG.md')
         ->version("[" . $newVersion . "](https://github.com/$repository/tree/" . $newVersion . ") (" . date('Y-m-d') . ")")
         ->setBody($result)
         ->run();
   }
976419
public static function find($owner, $ownerId = null)
    {
        // get class
        if ($owner instanceof Pluf_Model) { // Pluf module
            $ownerClass = $owner->getClass();
            $ownerId = $owner->getId();
        } elseif (! is_null($owner)) { // module
            $ownerClass = $owner;
        }

        // get list
        $receipt = new Bank_Receipt();
        $q = new Pluf_SQL('owner_class=%s AND owner_id=%s', array(
            $ownerClass,
            $ownerId
        ));
        $list = $receipt->getList(array(
            'filter' => $q->gen()
        ));
        return $list;
    }
566843
public function designAction($owner, $ownerId)
    {
        /** @var BlockManager $blockManager */
        $blockManager = $this->get('opifer.content.block_manager');
        $manager = $this->get('opifer.content.content_manager');

        /** @var AbstractDesignSuite $suite */
        $suite = $this->get(sprintf('opifer.content.%s_design_suite', $owner));
        $suite->load($ownerId);

        $content = $manager->getRepository()->find($ownerId);

        $parameters = [
            'manager' => $blockManager,
            'toolset' => $blockManager->getToolset(),
            'id' => $suite->getSubject()->getId(),
            'owner' => $owner,
            'title' => $suite->getTitle(),
            'caption' => $suite->getCaption(),
            'permalink' => $suite->getPermalink(),
            'defaultDomain' => (($content && $content->getSite()) ? $content->getSite()->getDefaultDomain() : null),
            'url_properties' => $suite->getPropertiesUrl(),
            'url_cancel' => $suite->getCancelUrl(),
            'url' => $suite->getCanvasUrl(),
        ];

        return $this->render($this->getParameter('opifer_content.content_design_view'), $parameters);
    }
322925
public function permAssign($permid, $permvalue, $permskip = FALSE)
  {
    $this->getParent()->clientPermAssign($this["client_database_id"], $permid, $permvalue, $permskip);
  }
881018
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->getOAuth()->getAuthServer()
          ->getGrantType('authorization_code')
          ->newAuthoriseRequest($owner, $owner_id, $options);
  }
76757
public function editComment($owner, $repo, $id, $body)
	{
		$data = array();
		$data['body'] = $body;

		return $this->client->request("/repos/$owner/$repo/issues/comments/$id", 'PATCH', json_encode($data), 200, 'GitHubIssueComment');
	}
226009
public function viewAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        return $this->render($environment->getView(), $environment->getViewParameters());
    }
76479
private function menuBranch($owner = 0, $level = 0)
    {
        $result = array(array(), array());
        $items = Eresus_CMS::getLegacyKernel()->db->select('pages',
            "(`access` >= '" . USER . "') AND (`owner` = '" . $owner . "') AND (`active` = '1')",
            "-position", "`id`,`caption`");
        if (count($items))
        {
            foreach ($items as $item)
            {
                $result[0][] = str_repeat('- ', $level) . $item['caption'];
                $result[1][] = $item['id'];
                $sub = $this->menuBranch($item['id'], $level + 1);
                if (count($sub[0]))
                {
                    $result[0] = array_merge($result[0], $sub[0]);
                    $result[1] = array_merge($result[1], $sub[1]);
                }
            }
        }
        return $result;
    }