PressLabs/gitium

View on GitHub
gitium/inc/class-gitium-submenu-settings.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '37', column '7').
Open

        new Gitium_Help( $submenu_hook, 'settings' );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid excessively long variable names like $submit_regenerate_pub_key. Keep variable name length under 20.
Open

        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Gitium_Submenu_Settings extends Gitium_Menu {

The class Gitium_Submenu_Settings is not named in CamelCase.
Open

class Gitium_Submenu_Settings extends Gitium_Menu {

    public function __construct() {
        parent::__construct( $this->gitium_menu_slug, $this->settings_menu_slug );
        add_action( GITIUM_ADMIN_MENU_ACTION, array( $this, 'admin_menu' ) );

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

Method name "Gitium_Submenu_Settings::admin_menu" is not in camel caps format
Open

    public function admin_menu() {

Method name "Gitium_Submenu_Settings::regenerate_webhook" is not in camel caps format
Open

    public function regenerate_webhook() {

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $gitium_regen_webhook ) ) {

Method name "Gitium_Submenu_Settings::show_webhook_table_webhook_url" is not in camel caps format
Open

    private function show_webhook_table_webhook_url() {

Method name "Gitium_Submenu_Settings::show_webhook_table" is not in camel caps format
Open

    public function show_webhook_table() {

Method name "Gitium_Submenu_Settings::show_webhook_table_public_key" is not in camel caps format
Open

    private function show_webhook_table_public_key() {

The closing brace for the class must go on the next line after the body
Open

}

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>

Opening brace of a class must be on the line after the definition
Open

class Gitium_Submenu_Settings extends Gitium_Menu {

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $submit_regenerate_pub_key ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Method name "Gitium_Submenu_Settings::regenerate_public_key" is not in camel caps format
Open

    public function regenerate_public_key() {

Expected 0 spaces before closing bracket; 1 found
Open

        if ( $this->git->set_gitignore( $gitignore_content ) ) {

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct() {

Spaces must be used to indent lines; tabs are not allowed
Open

        check_admin_referer( 'gitium-settings' );

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

            <th><label for="webhook-url"><?php _e( 'Webhook URL', 'gitium' ); ?>:</label></th>

Spaces must be used to indent lines; tabs are not allowed
Open

        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->success_redirect( __( 'Public key successfully regenerated.', 'gitium' ), $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

              <p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        <div class="wrap">

Spaces must be used to indent lines; tabs are not allowed
Open

            <tr>

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php

Spaces must be used to indent lines; tabs are not allowed
Open

            gitium_commit_and_push_gitignore_file();

Spaces must be used to indent lines; tabs are not allowed
Open

        parent::__construct( $this->gitium_menu_slug, $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->submenu_slug,

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Line exceeds 120 characters; contains 195 characters
Open

                    <p class="description"><?php _e( 'If your code use ssh keybased authentication for git you need to allow write access to your repository using this key.', 'gitium' ); ?><br />

Spaces must be used to indent lines; tabs are not allowed
Open

                    <?php _e( 'Checkout instructions for <a href="https://help.github.com/articles/generating-ssh-keys#step-3-add-your-ssh-key-to-github" target="_blank">github</a> or <a href="https://confluence.atlassian.com/display/BITBUCKET/Add+an+SSH+key+to+an+account#AddanSSHkeytoanaccount-HowtoaddakeyusingSSHforOSXorLinux" target="_blank">bitbucket</a>.', 'gitium' ); ?>

Spaces must be used to indent lines; tabs are not allowed
Open

                    </p>

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Line exceeds 120 characters; contains 125 characters
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->menu_slug,

Spaces must be used to indent lines; tabs are not allowed
Open

            'Settings',

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php

Spaces must be used to indent lines; tabs are not allowed
Open

                <td>

Spaces must be used to indent lines; tabs are not allowed
Open

        </table>

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        $submenu_hook = add_submenu_page(

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

        <tr>

Spaces must be used to indent lines; tabs are not allowed
Open

            <td>

Spaces must be used to indent lines; tabs are not allowed
Open

        $gitium_regen_webhook = filter_input(INPUT_POST, 'GitiumSubmitRegenerateWebhook', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Spaces must be used to indent lines; tabs are not allowed
Open

              <p><code id="webhook-url"><?php echo esc_url( gitium_get_webhook() ); ?></code>

Spaces must be used to indent lines; tabs are not allowed
Open

            </td>

Spaces must be used to indent lines; tabs are not allowed
Open

              <?php endif; ?>

Line exceeds 120 characters; contains 152 characters
Open

                    <input type="submit" name="GitiumSubmitRegeneratePublicKey" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" /></p>

Spaces must be used to indent lines; tabs are not allowed
Open

                    <input type="submit" name="GitiumSubmitRegeneratePublicKey" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" /></p>

Spaces must be used to indent lines; tabs are not allowed
Open

    public function show_webhook_table() {

Line exceeds 120 characters; contains 378 characters
Open

                    <?php _e( 'Checkout instructions for <a href="https://help.github.com/articles/generating-ssh-keys#step-3-add-your-ssh-key-to-github" target="_blank">github</a> or <a href="https://confluence.atlassian.com/display/BITBUCKET/Add+an+SSH+key+to+an+account#AddanSSHkeytoanaccount-HowtoaddakeyusingSSHforOSXorLinux" target="_blank">bitbucket</a>.', 'gitium' ); ?>

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

        <form action="" method="POST">

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php endif;

Spaces must be used to indent lines; tabs are not allowed
Open

        </p>

Spaces must be used to indent lines; tabs are not allowed
Open

    public function save() {

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Line exceeds 120 characters; contains 144 characters
Open

              <input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {

Spaces must be used to indent lines; tabs are not allowed
Open

        </form>

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'admin_init', array( $this, 'save' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

    public function admin_menu() {

Spaces must be used to indent lines; tabs are not allowed
Open

    public function regenerate_webhook() {

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        gitium_get_webhook_key( true );

Spaces must be used to indent lines; tabs are not allowed
Open

        check_admin_referer( 'gitium-settings' );

Line exceeds 120 characters; contains 128 characters
Open

              <p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>

Spaces must be used to indent lines; tabs are not allowed
Open

    private function show_webhook_table_public_key() {

Spaces must be used to indent lines; tabs are not allowed
Open

                </td>

Spaces must be used to indent lines; tabs are not allowed
Open

        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->show_message();

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( GITIUM_ADMIN_MENU_ACTION, array( $this, 'admin_menu' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

        );

Spaces must be used to indent lines; tabs are not allowed
Open

    public function regenerate_public_key() {

Spaces must be used to indent lines; tabs are not allowed
Open

        ?>

Spaces must be used to indent lines; tabs are not allowed
Open

                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

Spaces must be used to indent lines; tabs are not allowed
Open

        <h2><?php _e( 'Gitium Settings', 'gitium' ); ?></h2>

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

            GITIUM_MANAGE_OPTIONS_CAPABILITY,

Line exceeds 120 characters; contains 135 characters
Open

                          <a class="button" href="<?php echo esc_url( gitium_get_webhook() ); ?>" target="_blank">Merge changes</a></p>

Spaces must be used to indent lines; tabs are not allowed
Open

                    <p><input type="text" class="regular-text" name="public_key" id="public-key" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">

Spaces must be used to indent lines; tabs are not allowed
Open

    public function page() {

Spaces must be used to indent lines; tabs are not allowed
Open

        ?>

Line exceeds 120 characters; contains 126 characters
Open

        $gitium_regen_webhook = filter_input(INPUT_POST, 'GitiumSubmitRegenerateWebhook', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Line exceeds 120 characters; contains 168 characters
Open

                    <p><input type="text" class="regular-text" name="public_key" id="public-key" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">

Spaces must be used to indent lines; tabs are not allowed
Open

                    <p class="description"><?php _e( 'If your code use ssh keybased authentication for git you need to allow write access to your repository using this key.', 'gitium' ); ?><br />

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->success_redirect( __( 'The file `.gitignore` is saved!', 'gitium' ), $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php $this->show_webhook_table(); ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        <p class="submit">

Spaces must be used to indent lines; tabs are not allowed
Open

        new Gitium_Help( $submenu_hook, 'settings' );

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        gitium_get_keypair( true );

Spaces must be used to indent lines; tabs are not allowed
Open

              <input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />

Spaces must be used to indent lines; tabs are not allowed
Open

        </tr>

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

            <?php $this->show_webhook_table_public_key(); ?>

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        </div>

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'admin_init', array( $this, 'regenerate_webhook' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Line exceeds 120 characters; contains 133 characters
Open

        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( ! isset( $submit_regenerate_pub_key ) ) {

Spaces must be used to indent lines; tabs are not allowed
Open

    private function show_webhook_table_webhook_url() {

Spaces must be used to indent lines; tabs are not allowed
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        list( $git_public_key, ) = gitium_get_keypair();

Spaces must be used to indent lines; tabs are not allowed
Open

            <?php $this->show_webhook_table_webhook_url() ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

Spaces must be used to indent lines; tabs are not allowed
Open

        <p><span style="color:red;"><?php _e( 'Be careful when you modify this list!', 'gitium' ); ?></span></p>

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'admin_init', array( $this, 'regenerate_public_key' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

            __( 'Settings' ),

Spaces must be used to indent lines; tabs are not allowed
Open

            array( $this, 'page' )

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( ! isset( $gitium_regen_webhook ) ) {

Line exceeds 120 characters; contains 158 characters
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

            </tr>

Spaces must be used to indent lines; tabs are not allowed
Open

        ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        <table class="form-table">

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php wp_nonce_field( 'gitium-settings' ) ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        <textarea name="gitignore_content" rows="20" cols="140"><?php echo esc_html( $this->git->get_gitignore() ); ?></textarea>

Line exceeds 120 characters; contains 129 characters
Open

        <textarea name="gitignore_content" rows="20" cols="140"><?php echo esc_html( $this->git->get_gitignore() ); ?></textarea>

Spaces must be used to indent lines; tabs are not allowed
Open

        check_admin_referer( 'gitium-settings' );

Spaces must be used to indent lines; tabs are not allowed
Open

        if ( $this->git->set_gitignore( $gitignore_content ) ) {

Spaces must be used to indent lines; tabs are not allowed
Open

        <input type="submit" name="GitiumSubmitSave" class="button-primary" value="<?php _e( 'Save', 'gitium' ); ?>" />

Expected 0 spaces before closing bracket; 1 found
Open

        new Gitium_Help( $submenu_hook, 'settings' );

Space after opening parenthesis of function call prohibited
Open

        if ( ! isset( $gitium_regen_webhook ) ) {

Space after opening parenthesis of function call prohibited
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

            <th><label for="webhook-url"><?php _e( 'Webhook URL', 'gitium' ); ?>:</label></th>

Line indented incorrectly; expected 16 spaces, found 14
Open

              <?php endif; ?>

Opening brace should be on a new line
Open

    private function show_webhook_table_public_key() {

Expected 0 spaces before closing bracket; 1 found
Open

                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

Line indented incorrectly; expected 16 spaces, found 14
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Space after opening parenthesis of function call prohibited
Open

        add_action( GITIUM_ADMIN_MENU_ACTION, array( $this, 'admin_menu' ) );

Opening brace should be on a new line
Open

    public function admin_menu() {

Space after opening parenthesis of function call prohibited
Open

        $this->success_redirect( __( 'Public key successfully regenerated.', 'gitium' ), $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        check_admin_referer( 'gitium-settings' );

Space after opening parenthesis of function call prohibited
Open

        if ( $this->git->set_gitignore( $gitignore_content ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        <h2><?php _e( 'Gitium Settings', 'gitium' ); ?></h2>

Opening brace should be on a new line
Open

    public function __construct() {

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $submit_regenerate_pub_key ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        $this->success_redirect( __( 'Public key successfully regenerated.', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

              <p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>

Space after opening parenthesis of function call prohibited
Open

                    <p class="description"><?php _e( 'If your code use ssh keybased authentication for git you need to allow write access to your repository using this key.', 'gitium' ); ?><br />

Expected 0 spaces after opening bracket; 1 found
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Space after opening parenthesis of function call prohibited
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        gitium_get_keypair( true );

Space after opening parenthesis of function call prohibited
Open

              <p><code id="webhook-url"><?php echo esc_url( gitium_get_webhook() ); ?></code>

Expected 0 spaces after opening bracket; 1 found
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Opening brace should be on a new line
Open

    public function save() {

Expected 0 spaces before closing bracket; 1 found
Open

            $this->success_redirect( __( 'The file `.gitignore` is saved!', 'gitium' ), $this->settings_menu_slug );

Class name "Gitium_Submenu_Settings" is not in camel caps format
Open

class Gitium_Submenu_Settings extends Gitium_Menu {

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'admin_init', array( $this, 'regenerate_webhook' ) );

Space after opening parenthesis of function call prohibited
Open

        check_admin_referer( 'gitium-settings' );

Space after opening parenthesis of function call prohibited
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        $this->success_redirect( __( 'Public key successfully regenerated.', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

        $this->success_redirect( __( 'Public key successfully regenerated.', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

              <input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />

Expected 0 spaces before closing bracket; 1 found
Open

                    <input type="submit" name="GitiumSubmitRegeneratePublicKey" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" /></p>

Expected 0 spaces before closing bracket; 1 found
Open

        <input type="submit" name="GitiumSubmitSave" class="button-primary" value="<?php _e( 'Save', 'gitium' ); ?>" />

Expected 0 spaces after opening bracket; 1 found
Open

        if ( $this->git->set_gitignore( $gitignore_content ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Space after opening parenthesis of function call prohibited
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        parent::__construct( $this->gitium_menu_slug, $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'admin_init', array( $this, 'regenerate_public_key' ) );

Expected 0 spaces before closing bracket; 1 found
Open

            __( 'Settings' ),

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $gitium_regen_webhook ) ) {

Expected 0 spaces after opening bracket; 1 found
Open

        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>

Space after opening parenthesis of function call prohibited
Open

                    <input type="submit" name="GitiumSubmitRegeneratePublicKey" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" /></p>

Space after opening parenthesis of function call prohibited
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Space after opening parenthesis of function call prohibited
Open

        <textarea name="gitignore_content" rows="20" cols="140"><?php echo esc_html( $this->git->get_gitignore() ); ?></textarea>

Space after opening parenthesis of function call prohibited
Open

        add_action( 'admin_init', array( $this, 'regenerate_public_key' ) );

Expected 0 spaces after opening bracket; 1 found
Open

        if ( ! isset( $gitium_regen_webhook ) ) {

Space after opening parenthesis of function call prohibited
Open

        if ( ! isset( $submit_regenerate_pub_key ) ) {

Space after opening parenthesis of function call prohibited
Open

                          <a class="button" href="<?php echo esc_url( gitium_get_webhook() ); ?>" target="_blank">Merge changes</a></p>

Space after opening parenthesis of function call prohibited
Open

        add_action( 'admin_init', array( $this, 'save' ) );

Space after opening parenthesis of function call prohibited
Open

        add_action( 'admin_init', array( $this, 'regenerate_webhook' ) );

Expected 0 spaces after opening bracket; 1 found
Open

        if ( ! isset( $submit_regenerate_pub_key ) ) {

Space after opening parenthesis of function call prohibited
Open

                    <p><input type="text" class="regular-text" name="public_key" id="public-key" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">

Expected 0 spaces before closing bracket; 1 found
Open

            $this->success_redirect( __( 'The file `.gitignore` is saved!', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        check_admin_referer( 'gitium-settings' );

Expected 0 spaces before closing bracket; 1 found
Open

        check_admin_referer( 'gitium-settings' );

Expected 0 spaces before closing bracket; 1 found
Open

                    <?php _e( 'Checkout instructions for <a href="https://help.github.com/articles/generating-ssh-keys#step-3-add-your-ssh-key-to-github" target="_blank">github</a> or <a href="https://confluence.atlassian.com/display/BITBUCKET/Add+an+SSH+key+to+an+account#AddanSSHkeytoanaccount-HowtoaddakeyusingSSHforOSXorLinux" target="_blank">bitbucket</a>.', 'gitium' ); ?>

Opening brace should be on a new line
Open

    public function show_webhook_table() {

Space after opening parenthesis of function call prohibited
Open

            $this->success_redirect( __( 'The file `.gitignore` is saved!', 'gitium' ), $this->settings_menu_slug );

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( GITIUM_ADMIN_MENU_ACTION, array( $this, 'admin_menu' ) );

Space after opening parenthesis of function call prohibited
Open

            __( 'Settings' ),

Opening brace should be on a new line
Open

    public function regenerate_webhook() {

Expected 0 spaces before closing bracket; 1 found
Open

              <?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>

Expected 0 spaces before closing bracket; 1 found
Open

                    <p><input type="text" class="regular-text" name="public_key" id="public-key" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">

Space after opening parenthesis of function call prohibited
Open

        <?php wp_nonce_field( 'gitium-settings' ) ?>

Expected 0 spaces before closing bracket; 1 found
Open

        <textarea name="gitignore_content" rows="20" cols="140"><?php echo esc_html( $this->git->get_gitignore() ); ?></textarea>

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'admin_init', array( $this, 'save' ) );

Space after opening parenthesis of function call prohibited
Open

        gitium_get_webhook_key( true );

Expected 0 spaces before closing bracket; 1 found
Open

        gitium_get_webhook_key( true );

Opening brace should be on a new line
Open

    public function regenerate_public_key() {

Space after opening parenthesis of function call prohibited
Open

        gitium_get_keypair( true );

Opening brace should be on a new line
Open

    private function show_webhook_table_webhook_url() {

Expected 0 spaces before closing bracket; 1 found
Open

              <p><code id="webhook-url"><?php echo esc_url( gitium_get_webhook() ); ?></code>

Expected 0 spaces before closing bracket; 1 found
Open

              <input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />

Space after opening parenthesis of function call prohibited
Open

            $this->success_redirect( __( 'The file `.gitignore` is saved!', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

        parent::__construct( $this->gitium_menu_slug, $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

        new Gitium_Help( $submenu_hook, 'settings' );

Space after opening parenthesis of function call prohibited
Open

        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>

Space after opening parenthesis of function call prohibited
Open

                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

Space after opening parenthesis of function call prohibited
Open

                    <?php _e( 'Checkout instructions for <a href="https://help.github.com/articles/generating-ssh-keys#step-3-add-your-ssh-key-to-github" target="_blank">github</a> or <a href="https://confluence.atlassian.com/display/BITBUCKET/Add+an+SSH+key+to+an+account#AddanSSHkeytoanaccount-HowtoaddakeyusingSSHforOSXorLinux" target="_blank">bitbucket</a>.', 'gitium' ); ?>

Space after opening parenthesis of function call prohibited
Open

        check_admin_referer( 'gitium-settings' );

Space after opening parenthesis of function call prohibited
Open

        <input type="submit" name="GitiumSubmitSave" class="button-primary" value="<?php _e( 'Save', 'gitium' ); ?>" />

Expected 0 spaces before closing bracket; 1 found
Open

        <?php wp_nonce_field( 'gitium-settings' ) ?>

Space after opening parenthesis of function call prohibited
Open

        <p><span style="color:red;"><?php _e( 'Be careful when you modify this list!', 'gitium' ); ?></span></p>

Expected 0 spaces before closing bracket; 1 found
Open

        $this->success_redirect( __( 'Webhook URL regenerates. Please make sure you update any external references.', 'gitium' ), $this->settings_menu_slug );

Space after opening parenthesis of function call prohibited
Open

        check_admin_referer( 'gitium-settings' );

Space after opening parenthesis of function call prohibited
Open

            <th><label for="webhook-url"><?php _e( 'Webhook URL', 'gitium' ); ?>:</label></th>

Expected 0 spaces before closing bracket; 1 found
Open

                          <a class="button" href="<?php echo esc_url( gitium_get_webhook() ); ?>" target="_blank">Merge changes</a></p>

Expected 0 spaces before closing bracket; 1 found
Open

              <p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>

Opening brace should be on a new line
Open

    public function page() {

Space after opening parenthesis of function call prohibited
Open

        <h2><?php _e( 'Gitium Settings', 'gitium' ); ?></h2>

Expected 0 spaces before closing bracket; 1 found
Open

        <p><span style="color:red;"><?php _e( 'Be careful when you modify this list!', 'gitium' ); ?></span></p>

Expected 0 spaces before closing bracket; 1 found
Open

                    <p class="description"><?php _e( 'If your code use ssh keybased authentication for git you need to allow write access to your repository using this key.', 'gitium' ); ?><br />

Expected 0 spaces before closing bracket; 1 found
Open

        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        if ( $this->git->set_gitignore( $gitignore_content ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

            $this->redirect( __( 'The file `.gitignore` could not be saved!', 'gitium' ), false, $this->settings_menu_slug );

The variable $submit_save is not named in camelCase.
Open

    public function save() {
        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {
            return;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $gitium_regen_webhook is not named in camelCase.
Open

    public function regenerate_webhook() {
        $gitium_regen_webhook = filter_input(INPUT_POST, 'GitiumSubmitRegenerateWebhook', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $gitium_regen_webhook ) ) {
            return;
        }

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $git_public_key is not named in camelCase.
Open

    private function show_webhook_table_public_key() {
        list( $git_public_key, ) = gitium_get_keypair();
        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>
            <tr>
                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $gitignore_content is not named in camelCase.
Open

    public function save() {
        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {
            return;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $gitignore_content is not named in camelCase.
Open

    public function save() {
        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {
            return;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $submenu_hook is not named in camelCase.
Open

    public function admin_menu() {
        $submenu_hook = add_submenu_page(
            $this->menu_slug,
            'Settings',
            __( 'Settings' ),

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $git_public_key is not named in camelCase.
Open

    private function show_webhook_table_public_key() {
        list( $git_public_key, ) = gitium_get_keypair();
        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>
            <tr>
                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $submenu_hook is not named in camelCase.
Open

    public function admin_menu() {
        $submenu_hook = add_submenu_page(
            $this->menu_slug,
            'Settings',
            __( 'Settings' ),

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $gitium_regen_webhook is not named in camelCase.
Open

    public function regenerate_webhook() {
        $gitium_regen_webhook = filter_input(INPUT_POST, 'GitiumSubmitRegenerateWebhook', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $gitium_regen_webhook ) ) {
            return;
        }

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $gitignore_content is not named in camelCase.
Open

    public function save() {
        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {
            return;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $submit_regenerate_pub_key is not named in camelCase.
Open

    public function regenerate_public_key() {
        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_regenerate_pub_key ) ) {
            return;
        }

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $submit_regenerate_pub_key is not named in camelCase.
Open

    public function regenerate_public_key() {
        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_regenerate_pub_key ) ) {
            return;
        }

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $submit_save is not named in camelCase.
Open

    public function save() {
        $submit_save = filter_input(INPUT_POST, 'GitiumSubmitSave', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        $gitignore_content = filter_input(INPUT_POST, 'gitignore_content', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_save ) || ! isset( $gitignore_content ) ) {
            return;

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The method admin_menu is not named in camelCase.
Open

    public function admin_menu() {
        $submenu_hook = add_submenu_page(
            $this->menu_slug,
            'Settings',
            __( 'Settings' ),

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method regenerate_webhook is not named in camelCase.
Open

    public function regenerate_webhook() {
        $gitium_regen_webhook = filter_input(INPUT_POST, 'GitiumSubmitRegenerateWebhook', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $gitium_regen_webhook ) ) {
            return;
        }

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method regenerate_public_key is not named in camelCase.
Open

    public function regenerate_public_key() {
        $submit_regenerate_pub_key = filter_input(INPUT_POST, 'GitiumSubmitRegeneratePublicKey', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        if ( ! isset( $submit_regenerate_pub_key ) ) {
            return;
        }

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method show_webhook_table_public_key is not named in camelCase.
Open

    private function show_webhook_table_public_key() {
        list( $git_public_key, ) = gitium_get_keypair();
        if ( ! defined( 'GIT_KEY_FILE' ) || GIT_KEY_FILE == '' ) : ?>
            <tr>
                <th><label for="public-key"><?php _e( 'Public Key', 'gitium' ); ?>:</label></th>

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method show_webhook_table_webhook_url is not named in camelCase.
Open

    private function show_webhook_table_webhook_url() {
        ?>
        <tr>
            <th><label for="webhook-url"><?php _e( 'Webhook URL', 'gitium' ); ?>:</label></th>
            <td>

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method show_webhook_table is not named in camelCase.
Open

    public function show_webhook_table() {
        ?>
        <table class="form-table">
            <?php $this->show_webhook_table_webhook_url() ?>
            <?php $this->show_webhook_table_public_key(); ?>

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status