Skip to content

SideCI Demo Pull Request #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sideci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linter:
rubocop:
root_dir: 'sideci_demo'

phpmd:
root_dir: 'sideci_demo'
options:
rule: 'phpmd.xml'
14 changes: 14 additions & 0 deletions sideci_demo/phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<ruleset name="SideCI demo rule set">
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/controversial.xml">
<exclude name="CamelCaseClassName"></exclude>
<exclude name="CamelCasePropertyName"></exclude>
<exclude name="CamelCaseMethodName"></exclude>
<exclude name="CamelCaseParameterName"></exclude>
<exclude name="CamelCaseVariableName"></exclude>
</rule>
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
</ruleset>
51 changes: 51 additions & 0 deletions sideci_demo/phpmd_demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

use Github\Client;

class Repository
{
private $owner;
private $name;
private $public;
private $branches;

const PublicVisibility = 'public';

/**
* @param string $owner
* @param string $name
* @param string $visibility
*/
public function Repository(string $owner, string $name, string $visibility)
{
$this->owner = $owner;
$this->name = $name;
$this->public = $visibility === PublicVisibility;
$this->client = new Client($_SERVER['API_TOKEN']);
}

/**
* @return string
*/
public function getFullName(): string
{
return $this->owner . $this->name;
}

/**
* @return bool
*/
public function getPublic(): bool
{
return $this->public;
}

/**
* @param string $title
* @param string $description
*/
public function createIssue(string $title, string $description)
{
$this->client->createIssue($this->getFullName, $title, $description);
}
}