<?php

/*
 * This file is part of Instrument package
 *
 * Copyright (c) 2016 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   https://github.com/tuupola/instrument
 *
 */

namespace Instrument;

interface Metric
{
    public function setValue($value);
    public function getValue();
    public function getType();
}

<?php

/*
 * This file is part of Instrument package
 *
 * Copyright (c) 2016 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   https://github.com/tuupola/instrument
 *
 */

namespace Instrument;

interface Metric
{
    public function setValue($value);
    public function getValue();
    public function set($key, $value);
    public function get($key);

    public function setName($name);
    public function getName();

    public function getType();

    public function setTags(array $tags);
    public function getTags();
    public function addTag($key, $value);
    public function removeTag($key);
}

Add missing methods to the interface

Add missing methods to the interface


<?php

namespace Orchestra\Tenanti;

use Orchestra\Support\Fluent;

class Tenantor extends Fluent
{
    /**
     * Make a tenantor instance.
     *
     * @param  string  $name
     * @param  mixed  $key
     * @param  string|null  $connection
     *
     * @return static
     */
    public static function make(string $name, $key, $connection = null)
    {
        return new static(compact('name', 'key', 'connection'));
    }

    /**
     * Get tenant name.
     *
     * @return string
     */
    public function getTenantName(): string
    {
        return $this->attributes['name'];
    }

    /**
     * Get tenant key.
     *
     * @return mixed
     */
    public function getTenantKey()
    {
        return $this->attributes['key'];
    }

    /**
     * Get tenant connection name.
     *
     * @return string|null
     */
    public function getTenantConnectionName()
    {
        return $this->attributes['connection'];
    }
}

<?php

namespace Orchestra\Tenanti;

use Orchestra\Support\Fluent;
use Illuminate\Database\Eloquent\Model;

class Tenantor extends Fluent
{
    /**
     * Make a tenantor instance.
     *
     * @param  string  $name
     * @param  mixed  $key
     * @param  string|null  $connection
     * @param  \Illuminate\Database\Eloquent\Model|null  $model
     *
     * @return static
     */
    public static function make(string $name, $key, $connection = null, ?Model $model = null)
    {
        if ($key instanceof Model) {
            $model = $key;
            $key = $model->getKey();
            $connection = $connection ?? $model->getConnectionName();
        }

        return new static(compact('name', 'key', 'connection', 'model'));
    }

    /**
     * Get tenant model.
     *
     * @return \Illuminate\Database\Eloquent\Model|null
     */
    public function getTenantModel(): ?Model
    {
        return $this->attributes['model'];
    }

    /**
     * Get tenant name.
     *
     * @return string
     */
    public function getTenantName(): string
    {
        return $this->attributes['name'];
    }

    /**
     * Get tenant key.
     *
     * @return mixed
     */
    public function getTenantKey()
    {
        return $this->attributes['key'];
    }

    /**
     * Get tenant connection name.
     *
     * @return string|null
     */
    public function getTenantConnectionName()
    {
        return $this->attributes['connection'];
    }
}

Allow to store model instance.

Allow to store model instance.

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

trait Trait_currentMember
{
	protected $_current_member	=	null;

	protected function _checkCurrentMember()
	{
		if(isset($_SESSION['connected_user_id']))
			$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
		else
			$this->_current_member = new Model_Users();

		\Eliya\Tpl::set(['current_member' => $this->_current_member]);

		if(!isset($_SESSION['token_logout']))
			$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
	}

	protected function _redirectToCurrentMemberProfile()
	{
		$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
		exit;
	}
}

<?php

trait Trait_currentMember
{
	protected $_current_member	=	null;

	protected function _checkCurrentMember()
	{
		if(isset($_SESSION['connected_user_id']))
			$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
		else
			$this->_current_member = new Model_Users();

		if(empty($this->_current_member))
			$this->_current_member = new Model_Users();

		\Eliya\Tpl::set(['current_member' => $this->_current_member]);

		if(!isset($_SESSION['token_logout']))
			$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
	}

	protected function _redirectToCurrentMemberProfile()
	{
		$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
		exit;
	}
}

Fix user connection when session ID refers to deleted member


<?php
namespace tomlib\auth\config;

include_once dirname(__FILE__) . "/config.php";
include_once dirname(__FILE__) . "/object.php";

use tomlib\config as Config;
use tomlib\object as Object;

function load() {
		global $tomlib_auth_config;

		if(is_null($tomlib_auth_config))
				$tomlib_auth_config = Config\get_setting("auth");
}

function get_setting($name) {
		global $tomlib_auth_config;

		load();

		return Object\try_get_element($tomlib_auth_config, $name);
}

<?php
namespace tomlib\auth\config;

include_once dirname(__FILE__) . "/config.php";
include_once dirname(__FILE__) . "/object.php";

use tomlib\config as Config;
use tomlib\object as Object;

function load() {
		global $tomlib_auth_config;

		if(is_null($tomlib_auth_config))
				$tomlib_auth_config = Config\get_setting("auth");
}

function get_setting($name) {
		global $tomlib_auth_config;

		load();

		return Object\try_get_property($tomlib_auth_config, $name);
}

Replace try_get_element call with try_get_property

Replaced the try_get_element call with a try_get_property call in the get_setting function


<?php

return [
    // Header
    'login' => 'zaloguj',
    'logout' => 'wyloguj',
    'your profile' => 'twój profil',
    'conversations' => 'konwersacje',
    'settings' => 'ustawienia',
    'all' => 'Wszystko',

    'tabs' => [
        'new' => 'nowe',
        'comments' => 'komentarze',
        'entries' => 'wpisy',
    ],

    // Footer
    'homepage' => 'Strona główna',
    'group list' => 'Lista grup',
    'guide' => 'Przewodnik',
    'ranking' => 'Ranking',
    'rules' => 'Regulamin',
    'contact' => 'Kontakt',
    'night mode' => 'tryb nocny',
    'website uses' => 'Serwis wykorzystuje',
    'cookie files' => 'pliki cookies',
];

<?php

return [
    // Header
    'login' => 'zaloguj',
    'logout' => 'wyloguj',
    'your profile' => 'twój profil',
    'conversations' => 'konwersacje',
    'settings' => 'ustawienia',
    'all' => 'Wszystko',

    'tabs' => [
        'new' => 'nowe',
        'comments' => 'komentarze',
        'entries' => 'wpisy',
    ],

    // Footer
    'homepage' => 'Strona główna',
    'group list' => 'Lista grup',
    'guide' => 'Przewodnik',
    'ranking' => 'Ranking',
    'rules' => 'Regulamin',
    'contact' => 'Kontakt',
    'night mode' => 'tryb nocny',
    'website uses' => 'Serwis wykorzystuje',
    'cookie files' => 'pliki cookies',

    // Sidebars
    'popular contents' => 'Popularne treści',
    'popular comments' => 'Popularne komentarze',
    'stats' => 'Statystyki',

    // Actions
    'add' => 'Dodaj',
    'add comment' => 'Dodaj komentarz',
    'add link' => 'Dodaj link',
    'add content' => 'Dodaj treść',
    'block' => 'Zablokuj',
    'unblock' => 'Odblokuj',

    // Things
    'comments' => 'Komentarze',
    'group' => 'Grupa',
    'folders' => 'Foldery',

    // Other
    'description' => 'Opis',
    'title' => 'Tytuł',
    'recently popular' => 'Ostatnio popularne',
    'sort' => 'Sortowanie',
    'filter' => 'Filtrowanie',
    'url address' => 'Adres URL',
];

Add missing translations for Polish

Add missing translations for Polish


<?php

namespace Bolt\Extension\Bolt\Members\Event;

/**
 * Members event constant class.
 *
 * Copyright (C) 2014-2016 Gawain Lynch
 *
 * @author    Gawain Lynch <gawain.lynch@gmail.com>
 * @copyright Copyright (c) 2014-2016, Gawain Lynch
 * @license   https://opensource.org/licenses/MIT MIT
 */
class MembersEvents
{
    const MEMBER_LOGIN = 'member.login';
    const MEMBER_LOGOUT = 'member.logout';
    const MEMBER_ENABLE = 'member.enable';
    const MEMBER_DISABLE = 'member.disable';
    const MEMBER_PROFILE_EDIT = 'member.profile.edit';
    const MEMBER_PROFILE_PRE_SAVE = 'member.profile.pre_save';
    const MEMBER_PROFILE_POST_SAVE = 'member.profile.post_save';
    const MEMBER_PROFILE_REGISTER = 'member.profile.register';
    const MEMBER_PROFILE_VERIFY = 'member.profile.verify';
    const MEMBER_ROLE = 'member.role';
    const MEMBER_NOTIFICATION_PRE_SEND = 'member.notification.pre_send';
    const MEMBER_NOTIFICATION_FAILURE = 'member.notification.failure';

    /**
     * Singleton constructor.
     */
    private function __construct()
    {
    }
}

<?php

namespace Bolt\Extension\Bolt\Members\Event;

/**
 * Members event constant class.
 *
 * Copyright (C) 2014-2016 Gawain Lynch
 *
 * @author    Gawain Lynch <gawain.lynch@gmail.com>
 * @copyright Copyright (c) 2014-2016, Gawain Lynch
 * @license   https://opensource.org/licenses/MIT MIT
 */
class MembersEvents
{
    const MEMBER_LOGIN = 'member.login';
    const MEMBER_LOGOUT = 'member.logout';
    const MEMBER_ENABLE = 'member.enable';
    const MEMBER_DISABLE = 'member.disable';
    const MEMBER_PROFILE_EDIT = 'member.profile.edit';
    const MEMBER_PROFILE_PRE_SAVE = 'member.profile.pre_save';
    const MEMBER_PROFILE_POST_SAVE = 'member.profile.post_save';
    const MEMBER_PROFILE_REGISTER = 'member.profile.register';
    const MEMBER_PROFILE_RESET = 'member.profile.reset';
    const MEMBER_PROFILE_VERIFY = 'member.profile.verify';
    const MEMBER_ROLE = 'member.role';
    const MEMBER_NOTIFICATION_PRE_SEND = 'member.notification.pre_send';
    const MEMBER_NOTIFICATION_FAILURE = 'member.notification.failure';

    /**
     * Singleton constructor.
     */
    private function __construct()
    {
    }
}

Add a profile resetevent constant

Add a profile resetevent constant


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Legacy;

/**
 * @internal
 */
trait ConstraintTraitForV7
{
    public function count(): int
    {
        return $this->doCount();
    }

    public function toString(): string
    {
        return $this->doToString();
    }

    protected function additionalFailureDescription($other): string
    {
        return $this->doAdditionalFailureDescription($other);
    }

    protected function failureDescription($other): string
    {
        return $this->doFailureDescription($other);
    }

    protected function matches($other): bool
    {
        return $this->doMatches($other);
    }

    private function doAdditionalFailureDescription($other): string
    {
        return '';
    }

    private function doCount(): int
    {
        return 1;
    }

    private function doFailureDescription($other): string
    {
        return $this->exporter()->export($other).' '.$this->toString();
    }

    private function doMatches($other): bool
    {
        return false;
    }

    private function doToString(): string
    {
        return '';
    }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Legacy;

use SebastianBergmann\Exporter\Exporter;

/**
 * @internal
 */
trait ConstraintTraitForV7
{
    public function count(): int
    {
        return $this->doCount();
    }

    public function toString(): string
    {
        return $this->doToString();
    }

    protected function additionalFailureDescription($other): string
    {
        return $this->doAdditionalFailureDescription($other);
    }

    protected function exporter(): Exporter
    {
        if (null !== $this->exporter) {
            $this->exporter = new Exporter();
        }

        return $this->exporter;
    }

    protected function failureDescription($other): string
    {
        return $this->doFailureDescription($other);
    }

    protected function matches($other): bool
    {
        return $this->doMatches($other);
    }

    private function doAdditionalFailureDescription($other): string
    {
        return '';
    }

    private function doCount(): int
    {
        return 1;
    }

    private function doFailureDescription($other): string
    {
        return $this->exporter()->export($other).' '.$this->toString();
    }

    private function doMatches($other): bool
    {
        return false;
    }

    private function doToString(): string
    {
        return '';
    }
}

Add missing exporter function for PHPUnit 7


<?php

/**
 * This file is part of The OBMS project: https://github.com/obms/obms
 *
 * Copyright (c) Jaime Niñoles-Manzanera Jimeno.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace AdministrationBundle\Tests;

/**
  * Clase que prueba un comando de consola.
  * Utiliza CommandTestCase para crear una Symfony app y tener todo disponible para ejecutar el/los
  * comandos..
  */
 class CommandsTest extends CommandTestCase
 {
     public function testDefaultDoesNotInstall()
     {
         $client = self::createClient();
         $output = $this->runCommand($client, 'sample:data');

         $this->assertContains('Deleting sample data.. loading data.. ok', $output);
     }
 }

<?php

/**
 * This file is part of The OBMS project: https://github.com/obms/obms
 *
 * Copyright (c) Jaime Niñoles-Manzanera Jimeno.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace AdministrationBundle\Tests;

/**
  * Clase que prueba un comando de consola.
  * Utiliza CommandTestCase para crear una Symfony app y tener todo disponible para ejecutar el/los
  * comandos..
  */
 class CommandsTest extends CommandTestCase
 {
     public function setUp()
     {
         exec('php app/console doctrine:fixtures:load --no-interaction --env=test');
     }

     public function testDefaultDoesNotInstall()
     {
         $client = self::createClient();
         $output = $this->runCommand($client, 'sample:data');

         $this->assertContains('Deleting sample data.. loading data.. ok', $output);
     }
 }

Fix first time execution of sample:data command test.


<?php

namespace Galahad\LaravelAddressing\Collection;

use Illuminate\Support\Collection;

/**
 * Class AdministrativeAreaCollection
 *
 * @package Galahad\LaravelAddressing\Collection
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class AdministrativeAreaCollection extends Collection
{
    /**
     * @var array|mixed
     */
    protected $countryCode;

    /**
     * @var string
     */
    protected $parentId;

    /**
     * @var string|null
     */
    protected $locale = null;

    /**
     * @return array|mixed
     */
    public function getCountryCode()
    {
        return $this->countryCode;
    }

    /**
     * @param array|mixed $countryCode
     */
    public function setCountryCode($countryCode)
    {
        $this->countryCode = $countryCode;
    }

    /**
     * @return mixed
     */
    public function getParentId()
    {
        return $this->parentId;
    }

    /**
     * @param mixed $parentId
     */
    public function setParentId($parentId)
    {
        $this->parentId = $parentId;
    }

    /**
     * @return null
     */
    public function getLocale()
    {
        return $this->locale;
    }

    /**
     * @param null $locale
     */
    public function setLocale($locale)
    {
        $this->locale = $locale;
    }
}

<?php

namespace Galahad\LaravelAddressing\Collection;

use CommerceGuys\Addressing\Repository\SubdivisionRepository;
use Illuminate\Support\Collection;

/**
 * Class AdministrativeAreaCollection
 *
 * @package Galahad\LaravelAddressing\Collection
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class AdministrativeAreaCollection extends Collection
{
    /**
     * @var array|mixed
     */
    protected $countryCode;

    /**
     * @var string
     */
    protected $parentId;

    /**
     * @var string|null
     */
    protected $locale = null;

    /**
     * @var SubdivisionRepository
     */
    protected $subdivisionRepository;

    /**
     * @return array|mixed
     */
    public function getCountryCode()
    {
        return $this->countryCode;
    }

    /**
     * @param array|mixed $countryCode
     */
    public function setCountryCode($countryCode)
    {
        $this->countryCode = $countryCode;
    }

    /**
     * @return mixed
     */
    public function getParentId()
    {
        return $this->parentId;
    }

    /**
     * @param mixed $parentId
     */
    public function setParentId($parentId)
    {
        $this->parentId = $parentId;
    }

    /**
     * @return null
     */
    public function getLocale()
    {
        return $this->locale;
    }

    /**
     * @param null $locale
     */
    public function setLocale($locale)
    {
        $this->locale = $locale;
    }

    /**
     * @return mixed
     */
    public function getSubdivisionRepository()
    {
        return $this->subdivisionRepository;
    }

    /**
     * @param mixed $subdivisionRepository
     */
    public function setSubdivisionRepository(SubdivisionRepository $subdivisionRepository)
    {
        $this->subdivisionRepository = $subdivisionRepository;
    }
}

Include support for subdivision repository class


<?php

namespace oopapi;

require_once './Invokable.php';
require_once './RequestHandler.php';
require_once './Invokation.php';

$handler = new Invokation();
$handler();

<?php

require_once './Invokable.php';
require_once './NonInvokableException.php';
require_once './RequestHandler.php';
require_once './Invokation.php';
require_once './Authentication.php';
require_once './Authorization.php';

Remove namespace, require NonInvokableException.php, Authentication.php, Authorization.php


<?php

namespace Plinth;

abstract class Connector {

    /**
     * @var Main
     */
	private $_main;

	/**
	 * @param Main $main
	 */
	public function __construct(Main $main) {

		$this->_main = $main;

	}

    /**
     * @return Main
     */
	public function Main() {

		return $this->_main;

	}

}

<?php

namespace Plinth;

abstract class Connector {

    /**
     * @var Main
     */
	protected $main;

	/**
	 * @param Main $main
	 */
	public function __construct(Main $main) {

		$this->main = $main;

	}

    /**
     * @return Main
     */
	public function Main() {

		return $this->main;

	}

}

Make main protected in connector

Make main protected in connector


<?php

return [
    'defaults' => [
        'creator' => [
            'name' => ''
            // add creator default values if not set
        ],

        'updater' => [
            'name' => ''
            // add updater default values if not set
        ],
    ],
];

<?php

return [
    'defaults' => [
        'creator' => [
            'name' => '',
            // add creator default values if not set
        ],

        'updater' => [
            'name' => '',
            // add updater default values if not set
        ],
    ],
];

Add extra comma on config

Add extra comma on config


<?php

namespace Illuminate\Tests\Foundation;

use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\PackageAssetLoader;

class FoundationPackageAssetsTest extends TestCase
{
    public function tearDown()
    {
        m::close();
    }

    public function testAssetLoading()
    {
        $assetLoader = new PackageAssetLoader(new Filesystem, __DIR__ . '/fixtures/vendor');

        $this->assertEquals($assetLoader->get('providers'), ['foo', 'bar', 'baz']);
    }
}

<?php

namespace Illuminate\Tests\Foundation;

use PHPUnit\Framework\TestCase;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\PackageAssetLoader;

class FoundationPackageAssetsTest extends TestCase
{
    public function testAssetLoading()
    {
        $assetLoader = new PackageAssetLoader(new Filesystem, __DIR__ . '/fixtures/vendor');

        $this->assertEquals($assetLoader->get('providers'), ['foo', 'bar', 'baz']);
    }
}

Remove mockery call in test

Remove mockery call in test


<?php
namespace CrudJsonApi\Test\App\Model\Table;

class NationalCapitalsTable extends \Cake\ORM\Table
{
    public function initialize(array $config)
    {
        $this->belongsTo('Countries');
    }
}

<?php
namespace CrudJsonApi\Test\App\Model\Table;

class NationalCapitalsTable extends \Cake\ORM\Table
{
    public function initialize(array $config)
    {
        $this->hasMany('Countries');
    }
}

Fix the relationship with Countries

Fix the relationship with Countries


<?php

namespace React\EventLoop\Tick;

use SplQueue;

class FutureTickQueue
{
    private $queue;

    public function __construct()
    {
        $this->queue = new SplQueue();
    }

    /**
     * Add a callback to be invoked on a future tick of the event loop.
     *
     * Callbacks are guaranteed to be executed in the order they are enqueued.
     *
     * @param callable $listener The callback to invoke.
     */
    public function add(callable $listener)
    {
        $this->queue->enqueue($listener);
    }

    /**
     * Flush the callback queue.
     */
    public function tick()
    {
        // Only invoke as many callbacks as were on the queue when tick() was called.
        $count = $this->queue->count();

        while ($count--) {
            call_user_func(
                $this->queue->dequeue()
            );
        }
    }

    /**
     * Check if the next tick queue is empty.
     *
     * @return boolean
     */
    public function isEmpty()
    {
        return $this->queue->isEmpty();
    }
}

<?php

namespace React\EventLoop\Tick;

use SplQueue;

/**
 * A tick queue implementation that can hold multiple callback functions
 *
 * This class should only be used internally, see LoopInterface instead.
 *
 * @see LoopInterface
 * @internal
 */
final class FutureTickQueue
{
    private $queue;

    public function __construct()
    {
        $this->queue = new SplQueue();
    }

    /**
     * Add a callback to be invoked on a future tick of the event loop.
     *
     * Callbacks are guaranteed to be executed in the order they are enqueued.
     *
     * @param callable $listener The callback to invoke.
     */
    public function add(callable $listener)
    {
        $this->queue->enqueue($listener);
    }

    /**
     * Flush the callback queue.
     */
    public function tick()
    {
        // Only invoke as many callbacks as were on the queue when tick() was called.
        $count = $this->queue->count();

        while ($count--) {
            call_user_func(
                $this->queue->dequeue()
            );
        }
    }

    /**
     * Check if the next tick queue is empty.
     *
     * @return boolean
     */
    public function isEmpty()
    {
        return $this->queue->isEmpty();
    }
}

Mark internal tick API as final to discourage external usage


<?php
/**
 * Hook to add the OpenID provider to the authentication tab.
 *
 * @param array &$links  The links on the frontpage, split into sections.
 */
function openidProvider_hook_frontpage(&$links) {
	assert('is_array($links)');
	assert('array_key_exists("links", $links)');

	$links['auth'][] = array(
		'href' => SimpleSAML_Module::getModuleURL('openidProvider/user.php'),
		'text' => '{openidProvider:op:title_no_user}',
	);
}

<?php
/**
 * Hook to add the OpenID provider to the authentication tab.
 *
 * @param array &$links  The links on the frontpage, split into sections.
 */
function openidProvider_hook_frontpage(&$links) {
	assert('is_array($links)');
	assert('array_key_exists("links", $links)');

	$links['auth'][] = array(
		'href' => SimpleSAML_Module::getModuleURL('openidProvider/user.php'),
		'text' => '{openidProvider:openidProvider:title_no_user}',
	);
}

Fix translation tag for hook for openid provider

git-svn-id: a243b28a2a52d65555a829a95c8c333076d39ae1@2102 44740490-163a-0410-bde0-09ae8108e29a


<?php

namespace Expressly\Event;

use Symfony\Component\EventDispatcher\Event;

class ResponseEvent extends Event
{
    private $response;

    public function getResponse()
    {
        return is_array($this->response) ? $this->response : json_decode($this->response, true);
    }

    public function setResponse($response)
    {
        $this->response = $response;

        return $this;
    }
}

<?php

namespace Expressly\Event;

use Symfony\Component\EventDispatcher\Event;

class ResponseEvent extends Event
{
    private $response;

    public function getResponse()
    {
        if (is_array($this->response)) {
            return $this->response;
        }

        return (json_last_error() == JSON_ERROR_NONE) ? json_decode($this->response, true) : $this->response;
    }

    public function setResponse($response)
    {
        $this->response = $response;

        return $this;
    }
}

Check for JSON errors when converting

Check for JSON errors when converting


<?php
/* ------------------------------------------------------------------------ *\
 * Post Types
\* ------------------------------------------------------------------------ */

/**
 * Register resource post type
 *
 * @return void
 */
function __gulp_init_namespace___create_resource_post_type(): void {
    register_extended_post_type("resource", [
        "menu_icon" => "dashicons-admin-links",
    ],
    [
        "plural"   => __("Resources", "__gulp_init_namespace__"),
        "singular" => __("Resource", "__gulp_init_namespace__"),
        "slug"     => "resource",
    ]);

    register_extended_taxonomy("resource_tag", "resource", [
        "hierarchical" => false,
    ],
    [
        "plural"   => __("Resource Tags", "__gulp_init_namespace__"),
        "singular" => __("Resource Tag", "__gulp_init_namespace__"),
        "slug"     => "",
    ]);
}
add_action("init", "__gulp_init_namespace___create_resource_post_type");

<?php
/* ------------------------------------------------------------------------ *\
 * Post Types
\* ------------------------------------------------------------------------ */

/**
 * Register resource post type
 *
 * @return void
 */
function __gulp_init_namespace___create_resource_post_type(): void {
    register_extended_post_type("resource", [
        "menu_icon" => "dashicons-admin-links",
    ],
    [
        "plural"   => __("Resources", "__gulp_init_namespace__"),
        "singular" => __("Resource", "__gulp_init_namespace__"),
        "slug"     => "resource",
    ]);

    register_extended_taxonomy("resource_tag", "resource", [
        "hierarchical" => false,
        "labels"       => [
            "menu_name" => __("Tags", "__gulp_init_namespace__"),
        ],
    ],
    [
        "plural"   => __("Resource Tags", "__gulp_init_namespace__"),
        "singular" => __("Resource Tag", "__gulp_init_namespace__"),
        "slug"     => "",
    ]);
}
add_action("init", "__gulp_init_namespace___create_resource_post_type");

Set `menu_name` to improve consistency within the dashboard


<?php // no direct access
defined('_JEXEC') or die('Restricted access');?>
<form method="get" action="/search" id="searchform"<?php if ($params->get('moduleclass_sfx')) { echo ' class="'.$params->get('moduleclass_sfx').'"'; } ?>>
	<fieldset>
		<legend><?php echo $text; ?></legend>
		<label for="searchword" id="searchword-label"><?php echo $text; ?></label>
		<input type="text" name="terms" id="searchword" size="<?php echo $width; ?>" value="<?php echo $text; ?>" />
	</fieldset>
</form>

<?php // no direct access
defined('_JEXEC') or die('Restricted access');?>
<form method="get" action="/search" id="searchform"<?php if ($params->get('moduleclass_sfx')) { echo ' class="'.$params->get('moduleclass_sfx').'"'; } ?>>
	<fieldset>
		<legend><?php echo $text; ?></legend>
		<label for="searchword" id="searchword-label"><?php echo $text; ?></label>
		<input type="text" name="terms" id="searchword" size="<?php echo $width; ?>" value="<?php echo $text; ?>" />
		<?php if ($params->get('button')) { echo '<input type="submit" name="submitquery" id="submitquery" value="' . $params->get('button_text') . '" />'; } ?>
	</fieldset>
</form>

Add submit button to hubbasic template mod_search override


<?php

namespace Application\Mapper;

class SettingMapper extends AbstractMapper
{

    /**
     * Returns a setting, or create an empty, unsaved one, if not found
     * @param integer $id
     * @return \Application\Model\Setting
     */
    public function fetch($id)
    {
        $rowset = $this->tableGateway->select(array('id' => $id));
        $setting = $rowset->current();

        if (!$setting) {
            $setting = $this->createRow();
            $setting->id = $id;
            $setting->value = null;
        }

        return $setting;
    }

}

<?php

namespace Application\Mapper;

class SettingMapper extends AbstractMapper
{

    /**
     * Returns a setting, or create an empty, unsaved one, if not found
     * @param integer $id
     * @return \Application\Model\Setting
     */
    public function fetch($id)
    {
        // Check if table exists
        $sql = new \Zend\Db\Sql\Select('pg_tables');
        $sql->where(array('tablename' => $this->tableGateway->getTable()));
        $tables = $this->tableGateway->getAdapter()->query($sql->getSqlString($this->tableGateway->getAdapter()->getPlatform()), \Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE);

        $setting = null;
        if ($tables->count()) {
            $rowset = $this->tableGateway->select(array('id' => $id));
            $setting = $rowset->current();
        }

        if (!$setting) {
            $setting = $this->createRow();
            $setting->id = $id;
            $setting->value = null;
        }

        return $setting;
    }

}

Check whether table exists for very first SQL migration


<?php

namespace Omnipay\Pacnet\Message;

/**
 * Pacnet Authorize Request
 */
class AuthorizeRequest extends SubmitRequest
{
    public function getData()
    {
        $data = parent::getData();

        $this->validate('card');

        $data['PymtType'] = 'cc_preauth';
        $data['CardBrand'] = $this->getCard()->getBrand();
        $data['CardNumber'] = $this->getCard()->getNumber();
        $data['ExpiryDate'] = $this->getCard()->getExpiryDate('my');

        if ($this->getCard()->getCvv()) {
            $data['CVV2'] = $this->getCard()->getCvv();
        }

        if ($this->getCard()->getName()) {
            $data['AccountName'] = $this->getCard()->getName();
        }

        $data['Signature'] = $this->generateSignature($data);

        return $data;
    }
}

<?php

namespace Omnipay\Pacnet\Message;

/**
 * Pacnet Authorize Request
 */
class AuthorizeRequest extends SubmitRequest
{
    public function getData()
    {
        $data = parent::getData();

        $data['PymtType'] = 'cc_preauth';

        if ( ! $this->getTransactionReference()) {
            $this->validate('card');

            $data['CardBrand'] = $this->getCard()->getBrand();
            $data['CardNumber'] = $this->getCard()->getNumber();
            $data['ExpiryDate'] = $this->getCard()->getExpiryDate('my');

            if ($this->getCard()->getCvv()) {
                $data['CVV2'] = $this->getCard()->getCvv();
            }

            if ($this->getCard()->getName()) {
                $data['AccountName'] = $this->getCard()->getName();
            }
        }
        else {
            $data['TemplateNumber'] = $this->getTransactionReference();
        }

        $data['Signature'] = $this->generateSignature($data);

        return $data;
    }
}

Allow a call to purchase with only a transactionReference for recurring payments


@extends ('base')

@section ('scripts')

@stop

@section('subheader')

@lang('app.demo.title')

@stop

@section ('content')
    @if ($isError)

                    Whoops! Something went terribly wrong here!

    @endif

            @include('transfugio::api.sidebar')

            @include('transfugio::api.main')

    @if (isset($paginationCode))

        {!! $paginationCode or '' !!}

    @endif
@stop

@extends ('base')

@section ('scripts')

@stop

@section('subheader')
@stop

@section ('content')
    @if ($isError)

                    Whoops! Something went terribly wrong here!

    @endif

            @include('transfugio::api.sidebar')

            @include('transfugio::api.main')

    @if (isset($paginationCode))

        {!! $paginationCode or '' !!}

    @endif
@stop

Remove title from api pages

Remove title from api pages


<?php
namespace Se7enChat\Libraries\Web\Presenters;
use Se7enChat\Boundaries\IndexOutputPort;
use Se7enChat\Gateways\UserInterfaceGateway;

class IndexPresenter implements IndexOutputPort
{
    private $userInterface;
    private $lessUrl;
    private $cssUrl;

    public function __construct(UserInterfaceGateway $ui)
    {
        $this->lessUrl = __DIR__ . '/../../UserInterface/Less';
        $this->cssUrl = CHAT_ROOT . 'Public/Styles';
        $this->userInterface = $ui;
    }

    public function present(array $information)
    {
        $this->compileCss();

        $this->userInterface->render('index', array(
            'pageTitle' => 'Se7enChat',
            'cssUrl' => PUBLIC_ROOT . '/Styles',
            'javascriptUrl' => PUBLIC_ROOT . '/Scripts',
            'imageUrl' => PUBLIC_ROOT . '/Images',
            'user_name' => 'Francisco',
            'user_id' => 1,
            'rooms' => array(
                array('name' => 'Room 1'),
                array('name' => 'Room 2', 'selected' => 'selected')
            )
        ));
    }

    private function compileCss()
    {
        $less = new \lessc;
        $less->checkedCompile(
            $this->lessUrl . '/index.less', $this->cssUrl . '/index.css');
    }
}

<?php
namespace Se7enChat\Libraries\Web\Presenters;
use Se7enChat\Boundaries\IndexOutputPort;
use Se7enChat\Gateways\UserInterfaceGateway;

class IndexPresenter implements IndexOutputPort
{
    private $userInterface;
    private $lessUrl;
    private $cssUrl;

    public function __construct(UserInterfaceGateway $ui)
    {
        $this->lessUrl = __DIR__ . '/../../UserInterface/Less';
        $this->cssUrl = CHAT_ROOT . 'Public/Styles';
        $this->userInterface = $ui;
    }

    public function present(array $information)
    {
        $this->compileCss();

        $this->userInterface->render('index', array(
            'pageTitle' => 'Se7enChat',
            'cssUrl' => PUBLIC_ROOT . '/Styles',
            'javascriptUrl' => PUBLIC_ROOT . '/Scripts',
            'imageUrl' => PUBLIC_ROOT . '/Images',
            'user_name' => 'Se7enChat',
            'user_id' => 1,
            'rooms' => array(
                array('name' => 'Room 1'),
                array('name' => 'Room 2', 'selected' => 'selected')
            )
        ));
    }

    private function compileCss()
    {
        $less = new \lessc;
        $less->checkedCompile(
            $this->lessUrl . '/index.less', $this->cssUrl . '/index.css');
    }
}

Change user name to something more practical.

Signed-off-by: Se7enChat <e5dc7202134ade0d04c45466a5972470210b05f6@zoho.com>


<?php

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: MIT
 */

namespace IDCI\Bundle\ExtraFormBundle\Form;

use IDCI\Bundle\ExtraFormBundle\Model\ConfiguredType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ConfiguredTypeType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('description')
            ->add('tags', 'extra_form_tags', array(
                'required' => false,
                'url' => '/api/configured-extra-form-types-tags.json',
            ))
            ->add('configuration')
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefaults(array(
                'data_class' => ConfiguredType::class,
            ))
        ;
    }

    /**
     * {@inheritdoc}
     *
     * @deprecated
     */
    public function setDefaultOptions(OptionsResolver $resolver)
    {
        $this->configureOptions($resolver);
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'idci_extraform_configured_type_type';
    }
}

<?php

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: MIT
 */

namespace IDCI\Bundle\ExtraFormBundle\Form;

use IDCI\Bundle\ExtraFormBundle\Form\Type\TagsType;
use IDCI\Bundle\ExtraFormBundle\Model\ConfiguredType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ConfiguredTypeType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('blockPrefix')
            ->add('description')
            ->add('tags', TagsType::class, array(
                'required' => false,
                'url' => '/api/configured-extra-form-types-tags.json',
            ))
            ->add('configuration')
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefaults(array(
                'data_class' => ConfiguredType::class,
            ))
        ;
    }

    /**
     * {@inheritdoc}
     *
     * @deprecated
     */
    public function setDefaultOptions(OptionsResolver $resolver)
    {
        $this->configureOptions($resolver);
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'idci_extraform_configured_type_type';
    }
}

Fix name field change & deprecated sf3.4


<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link           http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright      Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license        http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Zend\Stdlib\Hydrator\Filter;

use ReflectionException;
use ReflectionMethod;
use Zend\Stdlib\Exception\InvalidArgumentException;

class NumberOfParameterFilter implements FilterInterface
{
    /**
     * The number of parameters beeing accepted
     * @var int
     */
    protected $numberOfParameters = null;

    /**
     * @param int $numberOfParameters Number of accepted parameters
     */
    public function __construct($numberOfParameters = 0)
    {
        $this->numberOfParameters = (int) $numberOfParameters;
    }

    /**
     * @param string $property the name of the property
     * @return bool
     * @throws InvalidArgumentException
     */
    public function filter($property)
    {
        try {
            $reflectionMethod = new ReflectionMethod($property);
        } catch (ReflectionException $exception) {
            throw new InvalidArgumentException(
                "Method $property doesn't exist"
            );
        }

        if ($reflectionMethod->getNumberOfParameters() !== $this->numberOfParameters) {
            return false;
        }

        return true;
    }
}

<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link           http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright      Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license        http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Zend\Stdlib\Hydrator\Filter;

use ReflectionException;
use ReflectionMethod;
use Zend\Stdlib\Exception\InvalidArgumentException;

class NumberOfParameterFilter implements FilterInterface
{
    /**
     * The number of parameters beeing accepted
     * @var int
     */
    protected $numberOfParameters = null;

    /**
     * @param int $numberOfParameters Number of accepted parameters
     */
    public function __construct($numberOfParameters = 0)
    {
        $this->numberOfParameters = (int) $numberOfParameters;
    }

    /**
     * @param string $property the name of the property
     * @return bool
     * @throws InvalidArgumentException
     */
    public function filter($property)
    {
        try {
            $reflectionMethod = new ReflectionMethod($property);
        } catch (ReflectionException $exception) {
            throw new InvalidArgumentException(
                "Method $property doesn't exist"
            );
        }

        return $reflectionMethod->getNumberOfParameters() === $this->numberOfParameters;
    }
}

Return boolean instead of if statement.

Return boolean instead of if statement.


<?php namespace Sseffa\VideoApi;

use Illuminate\Support\ServiceProvider;

/**
 * Class VideoApiServiceProvider
 * @package Sseffa\VideoApi
 * @author Sefa Karagöz
 */
class VideoApiServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {

        $this->app['video-api'] = $this->app->share(function ()
        {

            return new VideoApi();
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {

        return array("video-api");
    }
}

<?php namespace Sseffa\VideoApi;

use Illuminate\Support\ServiceProvider;

/**
 * Class VideoApiServiceProvider
 * @package Sseffa\VideoApi
 * @author Sefa Karagöz
 */
class VideoApiServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {

        $this->app->singleton('video-api', function ()
        {

            return new VideoApi();
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {

        return array("video-api");
    }
}

Update Service Provider for L5.4

Update Service Provider for L5.4


@if (isset($related['researchers']) && sizeof($related['researchers']['docs']) > 0)
    <?php
        // preparation
        $researchers_array = array();
        foreach ($related['researchers']['docs'] as $col) {
            $researchers_array[$col['display_relationship']][] = $col;
        }
    ?>

    Researchers:
    @foreach($researchers_array as $relation=>$researchers)
        @foreach($researchers as $key=>$col)

                {{$col['to_title']}}

            @if($key!=sizeof($researchers)-1)
                ,
            @endif
        @endforeach
        ({{ $relation }})
    @endforeach
    @if($related['researchers']['count'] > 5)

        View all {{ $related['researchers']['count'] }} related researchers
    @endif

@endif

@if (isset($related['researchers']) && sizeof($related['researchers']['docs']) > 0)
    <?php
        // preparation
        $researchers_array = array();
        foreach ($related['researchers']['docs'] as $col) {
            $col['display_relationship'] = str_replace("Participant, ","", $col['display_relationship']);
            $col['display_relationship'] = str_replace(", Participant","", $col['display_relationship']);
            $researchers_array[$col['display_relationship']][] = $col;
        }
        $displayNum = 0;
    ?>

    Researchers:
    @foreach($researchers_array as $relation=>$researchers)
        @foreach($researchers as $key=>$col)
            <?php $displayNum++; ?>

                {{$col['to_title']}}

            @if($relation!="Participant")
                ({{ $relation }})
            @endif
            @if($displayNum<$related['researchers']['count'])
                ,
            @endif
        @endforeach

    @endforeach
    @if($related['researchers']['count'] > 5)

        View all {{ $related['researchers']['count'] }} related researchers
    @endif

@endif

Remove (Participant) relationship displayed after the last non PI researcher CC2608


<?php

use Heyday\Elastica\ReindexTask;
use SilverStripe\Core\Injector\Injector;
use Symbiote\QueuedJobs\Services\QueuedJobService;
use SilverStripe\CronTask\Interfaces\CronTask;

/**
 * These regular updates run as often as is practical.
 * They seem to take 2-3 hours at the moment, so we run them 4 times per day.
 */
class SilverStripeElasticaReindexCron implements CronTask
{

    /**
     * Run every 6 hours
     *
     * @return string
     */
    public function getSchedule()
    {
        return "0 */6 * * *";
    }

    /**
     * Run the build task SilverStripeElasticaReindexTask
     * @return void
     */
    public function process()
    {
        $taskClasses = [
            [UpdateSilverStripeVersionsTask::class, null],
            [UpdateAddonsTask::class, null],
            [ReindexTask::class, 'reindex=1'],
        ];

        foreach ($taskClasses as $taskInfo) {
            list($taskClass, $taskQuerystring) = $taskInfo;
            $job = new RunBuildTaskJob($taskClass, $taskQuerystring);
            $jobID = Injector::inst()->get(QueuedJobService::class)->queueJob($job);
            echo 'Added ' . $taskClass . ' to job queue (job ID ' . $jobID . ")\n";
        }
    }
}

<?php

use Heyday\Elastica\ReindexTask;
use SilverStripe\Core\Injector\Injector;
use Symbiote\QueuedJobs\Jobs\RunBuildTaskJob;
use Symbiote\QueuedJobs\Services\QueuedJobService;
use SilverStripe\CronTask\Interfaces\CronTask;

/**
 * These regular updates run as often as is practical.
 * They seem to take 2-3 hours at the moment, so we run them 4 times per day.
 */
class SilverStripeElasticaReindexCron implements CronTask
{

    /**
     * Run every 6 hours
     *
     * @return string
     */
    public function getSchedule()
    {
        return "0 */6 * * *";
    }

    /**
     * Run the build task SilverStripeElasticaReindexTask
     * @return void
     */
    public function process()
    {
        $taskClasses = [
            [UpdateSilverStripeVersionsTask::class, null],
            [UpdateAddonsTask::class, null],
            [ReindexTask::class, 'reindex=1'],
        ];

        foreach ($taskClasses as $taskInfo) {
            list($taskClass, $taskQuerystring) = $taskInfo;
            $job = new RunBuildTaskJob($taskClass, $taskQuerystring);
            $jobID = Injector::inst()->get(QueuedJobService::class)->queueJob($job);
            echo 'Added ' . $taskClass . ' to job queue (job ID ' . $jobID . ")\n";
        }
    }
}

FIX Import missing namespace for RunBuildTaskJob


<?php
/**
 * Laravel4-SirTrevorJs
 *
 * @link https://github.com/caouecs/Laravel4-SirTrevorJS
 */

namespace Caouecs\Sirtrevorjs\Converter;

/**
 * Sound for Sir Trevor Js
 *
 * @package Caouecs\Sirtrevorjs\Converter
 */
class SoundConverter
{
    /**
     * List of types for sound
     *
     * @access protected
     * @var array
     */
    protected $types = array(
        "spotify"
    );

    /**
     * Soundcloud block
     *
     * @access public
     * @return string
     */
    public function soundcloud()
    {
        $theme = (isset($this->config['soundcloud']) && $this->config['soundcloud'] === "full") ? "full" : "small";

        return $this->view("sound.soundcloud.".$theme, array(
            "remote" => $this->data['remote_id']
        ));
    }

    /**
     * Spotify block
     *
     * @access public
     * @return string
     */
    public function spotifyToHtml()
    {
        return $this->view("sound.spotify", array(
            "remote" => $this->data['remote_id'],
            "options" => $this->config['spotify']
        ));
    }
}

<?php
/**
 * Laravel4-SirTrevorJs
 *
 * @link https://github.com/caouecs/Laravel4-SirTrevorJS
 */

namespace Caouecs\Sirtrevorjs\Converter;

/**
 * Sound for Sir Trevor Js
 *
 * @package Caouecs\Sirtrevorjs\Converter
 */
class SoundConverter
{
    /**
     * List of types for sound
     *
     * @access protected
     * @var array
     */
    protected $types = array(
        "spotify"
    );

    /**
     * Soundcloud block
     *
     * @access public
     * @return string
     */
    public function soundcloudToHtml()
    {
        $theme = (isset($this->config['soundcloud']) && $this->config['soundcloud'] === "full") ? "full" : "small";

        return $this->view("sound.soundcloud.".$theme, array(
            "remote" => $this->data['remote_id']
        ));
    }

    /**
     * Spotify block
     *
     * @access public
     * @return string
     */
    public function spotifyToHtml()
    {
        return $this->view("sound.spotify", array(
            "remote" => $this->data['remote_id'],
            "options" => $this->config['spotify']
        ));
    }
}

Fix on soundcloudToHtml method name

Fix on soundcloudToHtml method name


<?php

namespace Picqer\Financials\Moneybird\Entities;

use Picqer\Financials\Moneybird\Actions\FindAll;
use Picqer\Financials\Moneybird\Actions\FindOne;
use Picqer\Financials\Moneybird\Actions\Removable;
use Picqer\Financials\Moneybird\Actions\Storable;
use Picqer\Financials\Moneybird\Model;

/**
 * Class Project.
 */
class Project extends Model
{
    use FindAll, FindOne, Storable, Removable;

    /**
     * @var array
     */
    protected $fillable = [
        'id',
        'name',
        'state',
    ];

    /**
     * @var string
     */
    protected $endpoint = 'projects';
}

<?php

namespace Picqer\Financials\Moneybird\Entities;

use Picqer\Financials\Moneybird\Actions\FindAll;
use Picqer\Financials\Moneybird\Actions\FindOne;
use Picqer\Financials\Moneybird\Actions\Removable;
use Picqer\Financials\Moneybird\Actions\Storable;
use Picqer\Financials\Moneybird\Model;

/**
 * Class Project.
 */
class Project extends Model
{
    use FindAll, FindOne, Storable, Removable;

    /**
     * @var array
     */
    protected $fillable = [
        'id',
        'name',
        'state',
    ];

    /**
     * @var string
     */
    protected $endpoint = 'projects';

    /**
     * @var string
     */
    protected $namespace = 'project';
}

Add missing namespace to project

Add missing namespace to project


<?php

namespace Tests\GtmPlugin\EventListener;

use GtmPlugin\EventListener\EnvironmentListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Xynnn\GoogleTagManagerBundle\Service\GoogleTagManager;

/**
 * Class EnvironmentListenerTest
 * @package Tests\GtmPlugin\EventListener
 * @covers \GtmPlugin\EventListener\EnvironmentListener
 */
class EnvironmentListenerTest extends \PHPUnit_Framework_TestCase
{

    public function testEnvironmentIsAddedToGtmObject()
    {
        $gtm = new GoogleTagManager(true, 'id1234');
        $listener = new EnvironmentListener(true, $gtm, 'test_env');
        $mock = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock();
        $listener->onKernelRequest($mock);

        $this->assertArrayHasKey('env', $gtm->getData());
        $this->assertSame($gtm->getData()['env'], 'test_env');
    }
}

<?php

namespace Tests\GtmPlugin\EventListener;

use GtmPlugin\EventListener\EnvironmentListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Xynnn\GoogleTagManagerBundle\Service\GoogleTagManager;

/**
 * Class EnvironmentListenerTest
 * @package Tests\GtmPlugin\EventListener
 * @covers \GtmPlugin\EventListener\EnvironmentListener
 */
class EnvironmentListenerTest extends \PHPUnit_Framework_TestCase
{

    public function testEnvironmentIsAddedToGtmObject()
    {
        $gtm = new GoogleTagManager(true, 'id1234');
        $listener = new EnvironmentListener($gtm, 'test_env');
        $mock = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock();
        $listener->onKernelRequest($mock);

        $this->assertArrayHasKey('env', $gtm->getData());
        $this->assertSame($gtm->getData()['env'], 'test_env');
    }
}

Fix test - forgot feature switch removal


<?php
/**
 * php-binary
 * A PHP library for parsing structured binary streams
 *
 * @package  php-binary
 * @author Damien Walsh <me@damow.net>
 */
namespace Binary\Field;

use Binary\Exception\ValidatorException;
use Binary\Validator\AbstractValidator;

/**
 * Field
 * Abstract.
 *
 * @since 1.0
 */
abstract class AbstractField implements FieldInterface
{
    /**
     * @public Binary\AbstractValidator[] Validators attached to the field.
     */
    private $validators = array();

    /**
     * @public string The name of the field.
     */
    public $name = '';

    /**
     * Attach a validator to the field.
     *
     * @param AbstractValidator $validator
     */
    public function addValidator(AbstractValidator $validator)
    {
        $this->validators[] = $validator;
    }

    /**
     * Check that the field is currently valid.
     */
    public function validate($value)
    {
        try {
            foreach ($this->validators as $validator) {
                $validator->validate($value);
            }
        } catch (ValidatorException $exception) {

            // Re-throw with field information
            throw new \ValidatorException(
                'Field ' . $this->name . ' failed validation: ' .
                $exception->getMessage()
            );

        }
    }
}

<?php
/**
 * php-binary
 * A PHP library for parsing structured binary streams
 *
 * @package  php-binary
 * @author Damien Walsh <me@damow.net>
 */
namespace Binary\Field;

use Binary\Exception\ValidatorException;
use Binary\Validator\AbstractValidator;

/**
 * Field
 * Abstract.
 *
 * @since 1.0
 */
abstract class AbstractField implements FieldInterface
{
    /**
     * @public Binary\AbstractValidator[] Validators attached to the field.
     */
    private $validators = array();

    /**
     * @public string The name of the field.
     */
    public $name = '';

    /**
     * Attach a validator to the field.
     *
     * @param AbstractValidator $validator
     */
    public function addValidator(AbstractValidator $validator)
    {
        $this->validators[] = $validator;
    }

    /**
     * Check that the field is currently valid.
     */
    public function validate($value)
    {
        try {
            foreach ($this->validators as $validator) {
                $validator->validate($value);
            }
        } catch (ValidatorException $exception) {

            // Re-throw with field information
            throw new ValidatorException(
                'Field ' . $this->name . ' failed validation: ' .
                $exception->getMessage()
            );

        }
    }
}

Fix typo in classpec for validator exception.


<?php namespace Nobox\LazyStrings;

use Illuminate\Support\ServiceProvider;
use Illuminate\Filesystem\Filesystem;

use Nobox\LazyStrings\Commands\LazyDeployCommand;

class LazyStringsServiceProvider extends ServiceProvider
{

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {
        $views = __DIR__ . '/../../views';
        $config = __DIR__ . '/../../config/lazy-strings.php';
        $routes = __DIR__ . '/../../routes.php';

        $this->loadViewsFrom($views, 'lazy-strings');

        $this->publishes([
            $config => config_path('lazy-strings.php'),
        ]);

        include $routes;
    }

    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        // add LazyStrings class to app container
        $this->app->bind('lazy-strings', function ($app) {
            return new LazyStrings(new Filesystem);
        });

        // register `lazy:deploy` command
        $this->app->bind('command.lazy-deploy', function ($app) {
            return new LazyDeployCommand();
        });

        $this->commands('command.lazy-deploy');
    }
}

<?php namespace Nobox\LazyStrings;

use Illuminate\Support\ServiceProvider;
use Illuminate\Filesystem\Filesystem;

use Nobox\LazyStrings\Commands\LazyDeployCommand;

class LazyStringsServiceProvider extends ServiceProvider
{

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {
        $views = __DIR__ . '/../views';
        $config = __DIR__ . '/../config/lazy-strings.php';
        $routes = __DIR__ . '/routes.php';

        $this->loadViewsFrom($views, 'lazy-strings');

        $this->publishes([
            $config => config_path('lazy-strings.php'),
        ]);

        include $routes;
    }

    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        // add LazyStrings class to app container
        $this->app->bind('lazy-strings', function ($app) {
            return new LazyStrings(new Filesystem);
        });

        // register `lazy:deploy` command
        $this->app->bind('command.lazy-deploy', function ($app) {
            return new LazyDeployCommand();
        });

        $this->commands('command.lazy-deploy');
    }
}

Update location of files on service provider.


<?php

namespace Accessible\Annotation;

/**
 * @Annotation
 * @Target("PROPERTY")
 */
class InitializeObject
{
    /**
     * The name of the class to initialize.
     *
     * @var mixed
     */
    private $className;

    /**
     * Initializes the annotation.
     *
     * @param mixed $className The name of the class.
     */
    public function __construct($className)
    {
        $this->value = $className['value'];
    }

    /**
     * Get the name of the class to initialize.
     *
     * @return mixed The value.
     */
    public function getClassName()
    {
        return $this->value;
    }
}

<?php

namespace Accessible\Annotation;

/**
 * @Annotation
 * @Target("PROPERTY")
 */
class InitializeObject
{
    /**
     * The name of the class to initialize.
     *
     * @var mixed
     */
    private $className;

    /**
     * Initializes the annotation.
     *
     * @param mixed $className The name of the class.
     */
    public function __construct($className)
    {
        $this->className = $className['value'];
    }

    /**
     * Get the name of the class to initialize.
     *
     * @return mixed The value.
     */
    public function getClassName()
    {
        return $this->className;
    }
}

Fix typo mistake in annotation attributes


<?php
class Kwc_List_ChildPages_Teaser_TeaserImage_Model extends Kwf_Component_FieldModel
{
    protected function _init()
    {
        parent::_init();
        $this->setDefault(array('link_text' => trlKwf('Read more').' »'));
    }
}

<?php
class Kwc_List_ChildPages_Teaser_TeaserImage_Model extends Kwf_Component_FieldModel
{
    protected function _init()
    {
        parent::_init();
        $this->setDefault(array('link_text' => '»'));
    }
}

Remove trl call from model

Remove trl call from model

this breaks build as we access models during clear-cache and don't have trl data built yet


<?php namespace App\Transformer;

use Place;
use League\Fractal\TransformerAbstract;

class PlaceTransformer extends TransformerAbstract
{
    protected $availableEmbeds = [
        'checkins'
    ];

    /**
     * Turn this item object into a generic array
     *
     * @return array
     */
    public function transform(Place $place)
    {
        return [
            'id'           => (int) $place->id,
            'name'         => $place->name,
            'lat'          => (float) $place->lat,
            'lon'          => (float) $place->lon,
            'address1'     => $place->address1,
            'address2'     => $place->address2,
            'city'         => $place->city,
            'state'        => $place->state,
            'zip'          => (float) $place->zip,
            'website'      => $place->website,
            'phone'        => $place->phone,
        ];
    }

    /**
     * Embed Checkins
     *
     * @return League\Fractal\Resource\Collection
     */
    public function embedCheckins(Place $place)
    {
        $checkins = $place->checkins;

        return $this->collectionResource($checkins, new CheckinTransformer);
    }
}

<?php namespace App\Transformer;

use Place;
use League\Fractal\TransformerAbstract;

class PlaceTransformer extends TransformerAbstract
{
    protected $availableEmbeds = [
        'checkins'
    ];

    /**
     * Turn this item object into a generic array
     *
     * @return array
     */
    public function transform(Place $place)
    {
        return [
            'id'           => (int) $place->id,
            'name'         => $place->name,
            'lat'          => (float) $place->lat,
            'lon'          => (float) $place->lon,
            'address1'     => $place->address1,
            'address2'     => $place->address2,
            'city'         => $place->city,
            'state'        => $place->state,
            'zip'          => (float) $place->zip,
            'website'      => $place->website,
            'phone'        => $place->phone,
        ];
    }

    /**
     * Embed Checkins
     *
     * @return League\Fractal\Resource\Collection
     */
    public function embedCheckins(Place $place)
    {
        $checkins = $place->checkins;

        return $this->collection($checkins, new CheckinTransformer);
    }
}

Fix collection call in embedCheckins

Fix collection call in embedCheckins


<?php namespace Picqer\Financials\Exact\Query;

trait Findable {

    public function find($id)
    {
        $result = $this->connection()->get($this->url, [
            '$filter' => $this->primaryKey . " eq guid'$id'"
        ]);

        return new self($this->connection(), $result);
    }

    public function filter($filter, $expand = '', $select='')
    {
        $request = [
            '$filter' => $filter
        ];
        if (strlen($expand) > 0)
        {
            $request['$expand'] = $expand;
        }
        if (strlen($select) > 0)
        {
            $request['$select'] = $select;
        }

        $result = $this->connection()->get($this->url, $request);

        return new self($this->connection(), $result);
    }

    public function get()
    {
        $result = $this->connection()->get($this->url);

        return $this->collectionFromResult($result);
    }

    public function collectionFromResult($result)
    {
        $collection = [];
        foreach ($result as $r)
        {
            $collection[] = new self($this->connection(), $r);
        }

        return $collection;
    }
}

<?php namespace Picqer\Financials\Exact\Query;

trait Findable
{

    public function find($id)
    {
        $result = $this->connection()->get($this->url, [
            '$filter' => $this->primaryKey . " eq guid'$id'"
        ]);

        return new self($this->connection(), $result);
    }

    public function filter($filter, $expand = '', $select = '')
    {
        $request = [
            '$filter' => $filter
        ];
        if (strlen($expand) > 0) {
            $request['$expand'] = $expand;
        }
        if (strlen($select) > 0) {
            $request['$select'] = $select;
        }

        $result = $this->connection()->get($this->url, $request);

        // If we have one result which is not an assoc array, make it the first element of an array for the
        // collectionFromResult function so we always return a collection from filter
        if ((bool) count(array_filter(array_keys($result), 'is_string'))) {
            $result = [ $result ];
        }

        return $this->collectionFromResult($result);
    }

    public function get()
    {
        $result = $this->connection()->get($this->url);

        return $this->collectionFromResult($result);
    }

    public function collectionFromResult($result)
    {
        $collection = [ ];
        foreach ($result as $r) {
            $collection[] = new self($this->connection(), $r);
        }

        return $collection;
    }
}

Make the filter() function always return a collection


<?php

namespace Trq\TodoBundle\Controller;

use FOS\RestBundle\View\View;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Trq\TodoBundle\Entity\Todo;

class TodoController extends Controller
{
    /**
     * getTodosAction
     *
     * @access public
     * @return void
     */
    public function getTodosAction()
    {
        $todos = $this->getDoctrine()
            ->getRepository('TrqTodoBundle:Todo')
            ->findAll();

        $view = View::create();
        $view->setData(['todos' => $todos]);
        return $view;
    }

    /**
     * getTodoAction
     *
     * @param mixed $todo
     * @access public
     * @return void
     */
    public function getTodoAction(Todo $todo)
    {
        return ['todo' => $todo];
    }
}

<?php

namespace Trq\TodoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Trq\TodoBundle\Entity\Todo;

class TodoController extends Controller
{
    /**
     * getTodosAction
     *
     * @access public
     * @return void
     */
    public function getTodosAction()
    {
        $todos = $this->getDoctrine()
            ->getRepository('TrqTodoBundle:Todo')
            ->findAll();

        return ['todos' => $todos];
    }

    /**
     * getTodoAction
     *
     * @param mixed $todo
     * @access public
     * @return void
     */
    public function getTodoAction(Todo $todo)
    {
        return ['todo' => $todo];
    }
}

Remove the View stuff, FOSRest handles this via listeners.


<?php

namespace Oro\Bundle\WorkflowBundle\Migrations\Schema\v1_14;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class OroWorkflowBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $table = $schema->createTable('oro_workflow_item');
        $table->addColumn('entity_class', 'string', ['notnull' => false]);
    }
}

<?php

namespace Oro\Bundle\WorkflowBundle\Migrations\Schema\v1_14;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class OroWorkflowBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        $table = $schema->getTable('oro_workflow_item');
        $table->addColumn('entity_class', 'string', ['notnull' => false]);
    }
}

BAP-10799: Update stepsAction in WidgetController
 - fixed migration


<?php

namespace Tests\Feature;

use Tests\TestCase;

class StatusTest extends TestCase
{
    /**
     * Test the home page returns a 200 status code (OK)
     *
     * @return void
     */
    public function testHomePage()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }

    /**
     * Test the login page redirects to GitHub
     *
     * @return void
     */
    public function testLoginPage()
    {
        $response = $this->get('login');
        parse_str(parse_url($response->headers->get('location'))['query'], $query);

        $response->assertRedirect('https://github.com/login/oauth/authorize?client_id='.env('GITHUB_ID').'&scope=user%3Aemail%2Cadmin%3Aorg&redirect_uri='.env('GITHUB_CALLBACK').'&response_type=code&state='.$query['state']);
    }

    /**
     * Test the dashboard page redirects to login
     *
     * @return void
     */
    public function testDashboard()
    {
        $response = $this->get('dashboard');

        $response->assertRedirect('login');
    }
}

<?php

namespace Tests\Feature;

use Tests\TestCase;
use App\User;

class StatusTest extends TestCase
{
    /**
     * Test the home page returns a 200 status code (OK)
     *
     * @return void
     */
    public function testHomePage()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }

    /**
     * Test the login page redirects to GitHub
     *
     * @return void
     */
    public function testLoginPage()
    {
        $response = $this->get('login');
        parse_str(parse_url($response->headers->get('location'))['query'], $query);

        $response->assertRedirect('https://github.com/login/oauth/authorize?client_id='.env('GITHUB_ID').'&scope=user%3Aemail%2Cadmin%3Aorg&redirect_uri='.env('GITHUB_CALLBACK').'&response_type=code&state='.$query['state']);
    }

    /**
     * Test the dashboard page redirects to login
     *
     * @return void
     */
    public function testDashboardAuth()
    {
        $response = $this->get('dashboard');

        $response->assertRedirect('login');
    }

    /**
     * Test the dashboard returns a 200 status code when logged in (OK)
     *
     * @return void
     */
    public function testDashboard()
    {
        $user = factory(User::class)->create();
        $response = $this->actingAs($user)
                         ->get('dashboard');

        $response->assertStatus(200);
    }
}

Add a logged-in test for the dashboard

:white_check_mark: Add a logged-in test for the dashboard


<?php

namespace Monolol\Lolifiers;

use Monolog\Logger;

class HashTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider testHandlingProvider
     */
    public function testHandling($level)
    {
        $record = array('level' => $level);

        $lolifier = new Hash();

        $this->assertTrue($lolifier->isHandling($record));
    }

    public function testHandlingProvider()
    {
        return array(
            'debug' => array(Logger::DEBUG),
            'info' => array(Logger::INFO),
            'notice' => array(Logger::NOTICE),
            'warning' => array(Logger::WARNING),
            'error' => array(Logger::ERROR),
            'critical' => array(Logger::CRITICAL),
            'alert' => array(Logger::ALERT),
            'emergency' => array(Logger::EMERGENCY),
        );
    }

    public function testHash()
    {
        $record = array('message' => 'my littlest pony', 'datetime' => new \DateTime());

        $lolifier = new Hash();
        $lolified = $lolifier->lolify($record);

        $this->assertNotSame($record, $lolified);
    }
}

<?php

namespace Monolol\Lolifiers;

use Monolog\Logger;

class HashTest extends \PHPUnit_Framework_TestCase
{
    public function testHandling()
    {
        $this->assertTrue((new Hash())->isHandling(array()));
    }

    public function testHash()
    {
        $record = array('message' => 'my littlest pony', 'datetime' => new \DateTime());

        $lolifier = new Hash();
        $lolified = $lolifier->lolify($record);

        $this->assertNotSame($record, $lolified);
    }
}

fix: Remove data provider Hash lolifier handling test


<?php

namespace Metrics\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Metrics\Http\Requests;
use Metrics\Http\Controllers\Controller;
use Metrics\Idol\Idol;

class IdolController extends Controller
{

    private $idol;

    public function __construct(Idol $idol)
    {
        $this->idol = $idol;
    }

    public function analyseKeyword(){
        $keyword = Input::get('keyword');
        $max_results = (Input::has('max_results')) ? Input::get('max_results') : 20;
        $idol = $this->idol;

        try {
            if (Input::has('min_date') || Input::has('max_date')) {
                $min_date = (Input::has('min_date')) ? Input::get('min_date') . 'e' : null;
                $max_date = (Input::has('max_date')) ? Input::get('max_date') . 'e' : null;
                $response = $idol->queryTextIndexByKeyword($keyword, $min_date, $max_date, $max_results);
            } else {
                $response = $idol->queryTwitterWithKeyword($keyword, $max_results);
            }
        } catch (\Exception $e) {
            return response()->json(['message' => $e->getMessage()], 500);
        }

        return response()->json($response, 200);
    }

}

<?php

namespace Metrics\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Metrics\Http\Requests;
use Metrics\Http\Controllers\Controller;
use Metrics\Idol\Idol;

class IdolController extends Controller
{

    private $idol;

    public function __construct(Idol $idol)
    {
        $this->idol = $idol;
    }

    public function analyseKeyword(){
        $keyword = Input::get('keyword');
        $max_results = (Input::has('max_results')) ? Input::get('max_results') : 20;
        $idol = $this->idol;

        try {
            if (Input::has('min_date') || Input::has('max_date')) {
                $min_date = (Input::has('min_date')) ? Input::get('min_date') . 'e' : null;
                $max_date = (Input::has('max_date')) ? Input::get('max_date') . 'e' : null;
                $response = $idol->queryTextIndexByKeyword($keyword, $min_date, $max_date, $max_results);
            } else {
                $response = $idol->queryTextIndexWithTicker($keyword, $max_results);
            }
        } catch (\Exception $e) {
            return response()->json(['message' => $e->getMessage()], 500);
        }

        return response()->json($response, 200);
    }

}

Implement Twittter; fix aggregate scores


<?php
/**
 * AdminLte Theme for Yii2 projects
 *
 * @link      https://github.com/hiqdev/yii2-theme-adminlte
 * @package   yii2-theme-adminlte
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
 */

namespace hiqdev\themes\adminlte;

use Yii;
use yii\helpers\FileHelper;
use yii\helpers\Html;

/**
 * Class for this theme.
 * It's almost empty cause inheritance does all the tricks.
 */
class AdminLteTheme extends \hiqdev\thememanager\Theme
{
    public $label = 'AdminLte';

    public function favicon(): string
    {
        $icon = Yii::getAlias(Yii::$app->params['favicon.ico']);
        $mimeType = FileHelper::getMimeType($icon);

        return Html::tag('link', null, ['rel' => 'shortcut icon', 'type' => $mimeType, 'href' => Yii::$app->assetManager->getPublishedUrl($icon)]);
    }
}

<?php
/**
 * AdminLte Theme for Yii2 projects
 *
 * @link      https://github.com/hiqdev/yii2-theme-adminlte
 * @package   yii2-theme-adminlte
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
 */

namespace hiqdev\themes\adminlte;

use hiqdev\yii\compat\yii;
use yii\helpers\FileHelper;
use yii\helpers\Html;

/**
 * Class for this theme.
 * It's almost empty cause inheritance does all the tricks.
 */
class AdminLteTheme extends \hiqdev\thememanager\Theme
{
    public $label = 'AdminLte';

    public function favicon(): string
    {
        $path = yii::getAlias(yii::getApp()->params['favicon.ico']);
        $mimeType = FileHelper::getMimeTypeByExtension($path);
        $publishedPath = yii::getApp()->assetManager->publish($path);
        $url = $publishedPath[1];

        return Html::tag('link', null, ['rel' => 'shortcut icon', 'type' => $mimeType, 'href' => $url]);
    }
}

Fix getting type, fix publish favicon

Fix getting type, fix publish favicon


<?php

declare(strict_types=1);

return [

    /*
    |--------------------------------------------------------------------------
    | Default Preset
    |--------------------------------------------------------------------------
    |
    | This option controls the default preset that will be used by PHP Insights
    | to make your code reliable, simple, and clean. However, you can always
    | adjust the `Metrics` and `Insights` below in this configuration file.
    |
    | Supported: "default", "laravel", "symfony"
    |
    */

    'preset' => 'symfony',

    /*
    |--------------------------------------------------------------------------
    | Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may adjust all the various `Insights` that will be used by PHP
    | Insights. You can either add, remove or configure `Insights`. Keep in
    | mind, that all added `Insights` must belong to a specific `Metric`.
    |
    */

    'add' => [
        //  ExampleMetric::class => [
        //      ExampleInsight::class,
        //  ]
    ],

    'remove' => [
        //  ExampleInsight::class,
        ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff::class,
        ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
        ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff::class,
        SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class,
    ],

    'config' => [
        //  ExampleInsight::class => [
        //      'key' => 'value',
        //  ],
    ],

];

<?php

declare(strict_types=1);

return [

    /*
    |--------------------------------------------------------------------------
    | Default Preset
    |--------------------------------------------------------------------------
    |
    | This option controls the default preset that will be used by PHP Insights
    | to make your code reliable, simple, and clean. However, you can always
    | adjust the `Metrics` and `Insights` below in this configuration file.
    |
    | Supported: "default", "laravel", "symfony"
    |
    */

    'preset' => 'symfony',

    /*
    |--------------------------------------------------------------------------
    | Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may adjust all the various `Insights` that will be used by PHP
    | Insights. You can either add, remove or configure `Insights`. Keep in
    | mind, that all added `Insights` must belong to a specific `Metric`.
    |
    */

    'add' => [
        //  ExampleMetric::class => [
        //      ExampleInsight::class,
        //  ]
    ],

    'remove' => [
        //  ExampleInsight::class,
        ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff::class,
        ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
        ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff::class,
        PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff::class,
        PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff::class,
        SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class,
    ],

    'config' => [
        //  ExampleInsight::class => [
        //      'key' => 'value',
        //  ],
    ],

];

Disable some PHP insights sniffs

tests: Disable some PHP insights sniffs


<?php

namespace APIBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Controller\Annotations as Rest;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use APIBundle\Entity\Exercise;
use APIBundle\Form\Type\EventType;
use APIBundle\Entity\Event;

class InjectTypeController extends Controller
{
    /**
     * @ApiDoc(
     *    description="List inject types"
     * )
     * @Rest\Get("/inject_types")
     */
    public function getInjectTypesAction(Request $request)
    {
        $url = $this->getParameter('worker_url') . '/cxf/contracts';
        $contracts = json_decode(file_get_contents($url), true);

        $other = array();
        $other['type'] = 'other';
        $other['fields'] = array();
        $other['fields'][] = array(
            'name' => 'content',
            'type' => 'textarea',
            'cardinality' => '1',
            'mandatory' => true,
        );

        $contracts[] = $other;

        $output = json_encode($contracts);
        return new Response($output);
    }
}

<?php

namespace APIBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Controller\Annotations as Rest;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use APIBundle\Entity\Exercise;
use APIBundle\Form\Type\EventType;
use APIBundle\Entity\Event;

class InjectTypeController extends Controller
{
    /**
     * @ApiDoc(
     *    description="List inject types"
     * )
     * @Rest\Get("/inject_types")
     */
    public function getInjectTypesAction(Request $request)
    {
        $url = $this->getParameter('worker_url') . '/cxf/contracts';
        $contracts = json_decode(file_get_contents($url), true);

        $other = array();
        $other['type'] = 'manual';
        $other['fields'] = array();
        $other['fields'][] = array(
            'name' => 'content',
            'type' => 'textarea',
            'cardinality' => '1',
            'mandatory' => true,
        );

        $contracts[] = $other;

        $output = json_encode($contracts);
        return new Response($output);
    }
}

Change 'other' type in 'manual' type

Change 'other' type in 'manual' type


<?php

namespace PHPSpec2\Exception;

class ClassNotFoundException extends Exception
{
    private $classname;

    public function __construct($classname)
    {
        $this->classname = $classname;

        parent::__construct(sprintf(
            'Class <value>%s</value> does not exists.',
            $classname
        ));
    }

    public function getClassname()
    {
        return $this->classname;
    }
}

<?php

namespace PHPSpec2\Exception;

class ClassNotFoundException extends Exception
{
    private $classname;

    public function __construct($classname)
    {
        $this->classname = $classname;

        parent::__construct(sprintf(
            'Class <value>%s</value> does not exist.',
            $classname
        ));
    }

    public function getClassname()
    {
        return $this->classname;
    }
}

Fix typo on class not found exception message


<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Cache
 * @subpackage Storage
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

namespace Zend\Cache\Storage;

/**
 * @category   Zend
 * @package    Zend_Cache
 * @subpackage Storage
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
interface IterableInterface extends \IteratorAggregate
{
    /**
     * Get the storage iterator
     *
     * @return IteratorInterface
     */
    // PHP 5.3.3: Fatal error: Can't inherit abstract function IteratorAggregate::getIterator()
    // (previously declared abstract in Zend\Cache\Storage\IterableInterface)
    //public function getIterator();
}

<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Cache
 * @subpackage Storage
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

namespace Zend\Cache\Storage;

/**
 * @category   Zend
 * @package    Zend_Cache
 * @subpackage Storage
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 *
 * @method IteratorInterface getIterator() Get the storage iterator
 */
interface IterableInterface extends \IteratorAggregate
{
}

phpdoc: Use class level method definition to re-define method return type


<?php

namespace Oro\Bundle\ActionBundle\Command;

use Symfony\Component\Console\Input\InputArgument;

use Oro\Component\ConfigExpression\ExpressionFactory;

class DebugConditionCommand extends AbstractDebugCommand
{
    const ARGUMENT_NAME = 'condition-name';
    const COMMAND_NAME = 'oro:debug:condition';

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this->setName(self::COMMAND_NAME)
            ->setDescription('Displays current "conditions" for an application')
            ->addArgument(self::ARGUMENT_NAME, InputArgument::OPTIONAL, 'A condition name')
            ->setHelp(<<<EOF
The <info>%command.name%</info> displays list of all conditions with full description:

  <info>php %command.full_name%</info>

EOF
            );
    }

    /**
     * {@inheritdoc}
     */
    protected function getFactoryServiceId()
    {
        return 'oro_action.expression.factory';
    }

    /**
     * {@inheritdoc}
     */
    protected function getArgumentName()
    {
        return self::ARGUMENT_NAME;
    }
}

<?php

namespace Oro\Bundle\ActionBundle\Command;

use Symfony\Component\Console\Input\InputArgument;

class DebugConditionCommand extends AbstractDebugCommand
{
    const ARGUMENT_NAME = 'condition-name';
    const COMMAND_NAME = 'oro:debug:condition';

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this->setName(self::COMMAND_NAME)
            ->setDescription('Displays current "conditions" for an application')
            ->addArgument(self::ARGUMENT_NAME, InputArgument::OPTIONAL, 'A condition name')
            ->setHelp(<<<EOF
The <info>%command.name%</info> displays list of all conditions with full description:

  <info>php %command.full_name%</info>
EOF
            );
    }

    /**
     * {@inheritdoc}
     */
    protected function getFactoryServiceId()
    {
        return 'oro_action.expression.factory';
    }

    /**
     * {@inheritdoc}
     */
    protected function getArgumentName()
    {
        return self::ARGUMENT_NAME;
    }
}

BAP-12009: Create command oro:debug:condition
- remove not used import


<?php

use Hubzero\Content\Migration\Base;

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
 * Migration script for adding is_default column
 **/
class Migration20140217151012ComCourses extends Base
{
	/**
	 * Up
	 **/
	public function up()
	{
		if ($this->db->tableExists('#__courses_offering_sections'))
		{
			if (!$db->tableHasField('#__courses_offering_sections', 'is_default'))
			{
				$query = "ALTER TABLE `#__courses_offering_sections` ADD `is_default` TINYINT(2)  NOT NULL  DEFAULT '0' AFTER `offering_id`";

				$db->setQuery($query);
				$db->query();
			}
		}
	}

	/**
	 * Down
	 **/
	public function down()
	{
		if ($this->db->tableExists('#__courses_offering_sections'))
		{
			if ($db->tableHasField('#__courses_offering_sections', 'is_default'))
			{
				$query = "ALTER TABLE `#__courses_offering_sections` DROP `is_default`;";

				$db->setQuery($query);
				$db->query();
			}
		}
	}
}

<?php

use Hubzero\Content\Migration\Base;

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
 * Migration script for adding is_default column
 **/
class Migration20140217151012ComCourses extends Base
{
	/**
	 * Up
	 **/
	public function up()
	{
		if ($this->db->tableExists('#__courses_offering_sections'))
		{
			if (!$this->db->tableHasField('#__courses_offering_sections', 'is_default'))
			{
				$query = "ALTER TABLE `#__courses_offering_sections` ADD `is_default` TINYINT(2)  NOT NULL  DEFAULT '0' AFTER `offering_id`";

				$this->db->setQuery($query);
				$this->db->query();
			}
		}
	}

	/**
	 * Down
	 **/
	public function down()
	{
		if ($this->db->tableExists('#__courses_offering_sections'))
		{
			if ($this->db->tableHasField('#__courses_offering_sections', 'is_default'))
			{
				$query = "ALTER TABLE `#__courses_offering_sections` DROP `is_default`;";

				$this->db->setQuery($query);
				$this->db->query();
			}
		}
	}
}

[COM_COURSES] Fix migration syntax. Forgot it changed recently...


@extends('layouts.app')
@section('content')

            Trios
            Statistics

@endsection

@extends('layouts.app')
@section('content')

            Trios
            Statistics
            Reports

@endsection

Add hyperlink in admin panel

Add hyperlink in admin panel


<?php

$app = [];

$app['config'] = [
    'db' => [
        'dsn'       => 'mysql:dbname=foler;host=localhost',
        'user'      => 'foler',
        'password'  => ''
    ],
    'url' => $_SERVER['PHP_SELF'],
    'debug' => false
];

if($app['config']['debug']):
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
endif;

$app['locale'] = 'en';

/**
 * Helps us split codes to associative array
 *
 * @param type $string
 * @param type $value
 * @param array $arr
 */
function joinStringToArr($string, $value, &$arr = array()) {

    $keys = explode('.', $string);

    $ref = &$arr;

    while ($key = array_shift($keys)) {
        $ref = &$ref[$key];
    }

    $ref = $value;

}

<?php

$app = [];

$app['config'] = [
    'db' => [
        'dsn'       => 'mysql:dbname=foler;host=localhost',
        'user'      => 'foler',
        'password'  => ''
    ],
    'url' => $_SERVER['PHP_SELF'],
    'debug' => false
];

if($app['config']['debug']):
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
endif;

$app['locale'] = 'en';

/**
 * Helps us split codes to associative array
 *
 * @param type $string
 * @param type $value
 * @param array $arr
 */
function joinStringToArr($string, $value, &$arr = []) {

    $keys = explode('.', $string);

    $ref = &$arr;

    while ($key = array_shift($keys)) {
        $ref = &$ref[$key];
    }

    $ref = $value;

}

Fix array notation in function

Fix array notation in function


<?php

use yii\db\Migration;

class m160516_095943_init extends Migration
{
    public function up()
    {
        $tableOptions = null;

        if ($this->db->driverName === 'mysql' || $this->db->driverName === 'mariadb') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%Cart}}', [
            'sessionId' => $this->string(),
            'cartData' => $this->text(),
            'PRIMARY KEY (`sessionId`)',
        ], $tableOptions);
    }

    public function down()
    {
        $this->dropTable('{{%Cart}}');
    }
}

<?php

use yii\db\Migration;

class m160516_095943_init extends Migration
{
    public function up()
    {
        $tableOptions = null;

        if ($this->db->driverName === 'mysql' || $this->db->driverName === 'mariadb') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%Cart}}', [
            'sessionId' => $this->string(),
            'cartData' => $this->text(),
        ], $tableOptions);
        $this->addPrimaryKey('cart_pk', '{{%Cart}}', 'sessionId');
    }

    public function down()
    {
        $this->dropTable('{{%Cart}}');
    }
}

Fix create database issue on Postgresql

Fix create database issue on Postgresql


<?php

class HeroModule extends PageModule
{
}

class PageModuleTest extends SapphireTest
{
    protected static $fixture_file = 'PageModuleTest.yml';

    /**
     * Test that we're able to create a page module.
     */
    public function testPageModuleCreation()
    {
        $hero = $this->objFromFixture('PageModule', 'hero');

        $this->assertEquals($hero->Title, 'Hero module');
    }

    /**
     * Test that the module render function is producing content.
     */
    public function testPageModuleRender()
    {
        Director::setBaseURL('http://www.example.com/');

        $hero = $this->objFromFixture('PageModule', 'hero');

        $this->assertNotEmpty($hero->Content());
    }

    /**
     * Test that we're able to creat a new module instance, then convert its type to a subclass.
     */
    public function testCreateNewModule()
    {
        $module = new PageModule();

        $module->NewClassName = 'HeroModule';
        $module->Write();

        $this->assertEquals($module->ClassName, 'HeroModule');
    }
}

<?php

class TestModule1 extends PageModule
{
}

class PageModuleTest extends SapphireTest
{
    protected static $fixture_file = 'PageModuleTest.yml';

    /**
     * Test that we're able to create a page module.
     */
    public function testPageModuleCreation()
    {
        $hero = $this->objFromFixture('PageModule', 'hero');

        $this->assertEquals($hero->Title, 'Hero module');
    }

    /**
     * Test that the module render function is producing content.
     */
    public function testPageModuleRender()
    {
        Director::setBaseURL('http://www.example.com/');

        $hero = $this->objFromFixture('PageModule', 'hero');

        $this->assertNotEmpty($hero->Content());
    }

    /**
     * Test that we're able to creat a new module instance, then convert its type to a subclass.
     */
    public function testCreateNewModule()
    {
        $module = new PageModule();

        $module->NewClassName = 'TestModule1';
        $module->Write();

        $this->assertEquals($module->ClassName, 'TestModule1');
    }
}

Rename test classes to avoid conflicts

Rename test classes to avoid conflicts


<?php

namespace TomPHP\ConfigServiceProvider\League;

use League\Container\ServiceProvider\AbstractServiceProvider;
use TomPHP\ConfigServiceProvider\ApplicationConfig;

final class ApplicationConfigServiceProvider extends AbstractServiceProvider
{
    /**
     * @var ApplicationConfig
     */
    private $config;

    /**
     * @var string
     */
    private $prefix;

    /**
     * @param ApplicationConfig $config
     * @param string            $prefix
     */
    public function __construct(ApplicationConfig $config, $prefix)
    {
        $this->prefix   = $prefix;
        $this->config   = $config;
        $this->provides = array_map(
            function ($key) {
                return $this->keyPrefix() . $key;
            },
            $config->getKeys()
        );
    }

    public function register()
    {
        $container = $this->getContainer();
        $prefix    = $this->keyPrefix();

        foreach ($this->config as $key => $value) {
            $this->getContainer()->share($prefix . $key, function () use ($value) {
                return $value;
            });
        }
    }

    /**
     * @return string
     */
    private function keyPrefix()
    {
        if (empty($this->prefix)) {
            return '';
        }

        return $this->prefix . $this->config->getSeparator();
    }
}

<?php

namespace TomPHP\ConfigServiceProvider\League;

use League\Container\ServiceProvider\AbstractServiceProvider;
use TomPHP\ConfigServiceProvider\ApplicationConfig;

final class ApplicationConfigServiceProvider extends AbstractServiceProvider
{
    /**
     * @var ApplicationConfig
     */
    private $config;

    /**
     * @var string
     */
    private $prefix;

    /**
     * @param ApplicationConfig $config
     * @param string            $prefix
     */
    public function __construct(ApplicationConfig $config, $prefix)
    {
        $this->prefix   = $prefix;
        $this->config   = $config;
        $this->provides = array_map(
            function ($key) {
                return $this->keyPrefix() . $key;
            },
            $config->getKeys()
        );
    }

    public function register()
    {
        $prefix = $this->keyPrefix();

        foreach ($this->config as $key => $value) {
            $this->container->share($prefix . $key, function () use ($value) {
                return $value;
            });
        }
    }

    /**
     * @return string
     */
    private function keyPrefix()
    {
        if (empty($this->prefix)) {
            return '';
        }

        return $this->prefix . $this->config->getSeparator();
    }
}

Use instance variable instead of getter

Use instance variable instead of getter