<?php namespace Orchestra\Foundation\Providers;

use Illuminate\Support\ServiceProvider;

class ExtensionServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var boolean
     */
    protected $defer = true;

    /**
     * Available orchestra extensions
     *
     * @var array
     */
    protected $extensions = [];

    /**
     * Register the service provider
     *
     * @return void
     */
    public function register()
    {
        $extension = $this->app['orchestra.extension'];

        foreach ($this->extensions as $name => $path) {
            if (is_numeric($name)) {
                $extension->finder()->addPath($path);
            } else {
                $extension->register($name, $path);
            }
        }
    }

    /**
     * Get the events that trigger this service provider to register.
     *
     * @return array
     */
    public function when()
    {
        return ['orchestra.extension: detecting'];
    }
}

<?php namespace Orchestra\Foundation\Providers;

use Illuminate\Support\ServiceProvider;

class ExtensionServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var boolean
     */
    protected $defer = true;

    /**
     * Available orchestra extensions
     *
     * @var array
     */
    protected $extensions = [];

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

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $finder = $this->app['orchestra.extension.finder'];

        foreach ($this->extensions as $name => $path) {
            if (is_numeric($name)) {
                $finder->addPath($path);
            } else {
                $finder->registerExtension($name, $path);
            }
        }
    }

    /**
     * Get the events that trigger this service provider to register.
     *
     * @return array
     */
    public function when()
    {
        return ['orchestra.extension: detecting'];
    }
}

Revert some stuff due to an issue where artisan would eager load all providers, causing an issue here.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace Smartbox\Integration\FrameworkBundle\Components\Queues\Drivers;

use Smartbox\Integration\FrameworkBundle\Components\Queues\QueueMessageInterface;

interface SyncQueueDriverInterface extends QueueDriverInterface
{

    /**
     * Returns true if a subscription already exists, false otherwise.
     *
     * @return bool
     */
    public function isSubscribed();

    /**
     * Creates a subscription to the given $queue, allowing to receive messages from it.
     *
     * @param string $queue Queue to subscribe
     */
    public function subscribe(string $queue);

    /**
     * Destroys the created subscription with a queue.
     */
    public function unSubscribe();

    /**
     * Returns One Serializable object from the queue.
     *
     * It requires to subscribe previously to a specific queue
     *
     * @return QueueMessageInterface|null
     *
     * @throws \Exception
     */
    public function receive();

    /**
     * Clean all the opened resources, must be called just before terminating the current request.
     */
    public function destroy();
}

<?php

declare(strict_types=1);

namespace Smartbox\Integration\FrameworkBundle\Components\Queues\Drivers;

use Smartbox\Integration\FrameworkBundle\Components\Queues\QueueMessageInterface;

interface SyncQueueDriverInterface extends QueueDriverInterface
{
    /**
     * Returns true if a subscription already exists, false otherwise.
     *
     * @return bool
     */
    public function isSubscribed();

    /**
     * Creates a subscription to the given $queue, allowing to receive messages from it.
     *
     * @param string $queue Queue to subscribe
     */
    public function subscribe(string $queue);

    /**
     * Destroys the created subscription with a queue.
     */
    public function unSubscribe();

    /**
     * Returns One Serializable object from the queue.
     *
     * It requires to subscribe previously to a specific queue
     *
     * @return QueueMessageInterface|null
     */
    public function receive();

    /**
     * Clean all the opened resources, must be called just before terminating the current request.
     */
    public function destroy();
}

Add declare strict type in interface where string typehint is used


<?php

namespace SnowIO\AttributeSetCode\Plugin;

use Magento\Catalog\Api\Data\ProductInterface;

class AttributeSetCodeProductRepositoryPlugin
{
    private $attributeSetCodeRepository;

    public function __construct(\SnowIO\AttributeSetCode\Model\AttributeSetCodeRepository $attributeSetCodeRepository)
    {
        $this->attributeSetCodeRepository = $attributeSetCodeRepository;
    }

    public function beforeSave(
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
        ProductInterface $product,
        $saveOptions = false
    ) {
        if (!$extensionAttributes = $product->getExtensionAttributes()) {
            return [$product, $saveOptions];
        }

        if (null === ($attributeSetCode = $extensionAttributes->getAttributeSetCode())) {
            return [$product, $saveOptions];
        }
        $attributeSetId = $this->attributeSetCodeRepository->getAttributeSetId(4, $attributeSetCode);
        $product->setAttributeSetId($attributeSetId);

        return [$product, $saveOptions];
    }
}

<?php

namespace SnowIO\AttributeSetCode\Plugin;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;

class AttributeSetCodeProductRepositoryPlugin
{
    private $attributeSetCodeRepository;

    public function __construct(\SnowIO\AttributeSetCode\Model\AttributeSetCodeRepository $attributeSetCodeRepository)
    {
        $this->attributeSetCodeRepository = $attributeSetCodeRepository;
    }

    public function beforeSave(
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
        ProductInterface $product,
        $saveOptions = false
    ) {
        if (!$extensionAttributes = $product->getExtensionAttributes()) {
            return [$product, $saveOptions];
        }

        if (null === ($attributeSetCode = $extensionAttributes->getAttributeSetCode())) {
            return [$product, $saveOptions];
        }
        $attributeSetId = $this->attributeSetCodeRepository->getAttributeSetId(4, $attributeSetCode);
        if ($attributeSetId === null) {
            throw new LocalizedException(new Phrase("The specified attribute set code %1 does not exist", [$attributeSetCode]));
        }
        $product->setAttributeSetId($attributeSetId);

        return [$product, $saveOptions];
    }
}

Throw exception if no attribute set id is found


<?php

namespace Oro\Bundle\SecurityBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;

class AclPermissionController extends Controller
{
    /**
     * @Route(
     *  "/acl-access-levels/{oid}", name="oro_security_access_levels" , requirements={"oid"="((\w+):)+(\w+)"
     * })
     */
    public function aclAccessLevelsAction($oid)
    {
        if (strpos($oid, 'entity') !== false) {
            $oid = str_replace('_', '\\', $oid);
        }

        $levels = $this
            ->get('oro_security.acl.manager')
            ->getAccessLevels($oid);
        $translator = $this->get('translator');
        foreach ($levels as $id => $label) {
            $levels[$id] = $translator->trans('oro.security.access-level.' . $label);
        }

        return new JsonResponse(
            $levels
        );
    }
}

<?php

namespace Oro\Bundle\SecurityBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;

class AclPermissionController extends Controller
{
    /**
     * @Route(
     *  "/acl-access-levels/{oid}", name="oro_security_access_levels" , requirements={"oid"="((\w+):)+(.*)"
     * })
     */
    public function aclAccessLevelsAction($oid)
    {
        if (strpos($oid, 'entity') !== false) {
            $oid = str_replace('_', '\\', $oid);
        }

        $levels = $this
            ->get('oro_security.acl.manager')
            ->getAccessLevels($oid);
        $translator = $this->get('translator');
        foreach ($levels as $id => $label) {
            $levels[$id] = $translator->trans('oro.security.access-level.' . $label);
        }

        return new JsonResponse(
            $levels
        );
    }
}

BAP-1534: Fix acl access levels selector on root entity


#
#   Auto generated Apache configuration
#       @author: hyn/multi-tenant
#       @see: http://laravel-tenancy.com
#       @time: {{ date('H:i:s d-m-Y') }}
#       @website id: {{ $website->id }}
#       @website uuid: {{ $website->uuid }}
#

@forelse($website->hostnames as $hostname)
    @include('tenancy.generators::webserver.apache.blocks.server', [
        'hostname' => $hostname,
        'website' => $website,
        'media' => $media
    ])
@empty
#
#   No hostnames found
#
@endforelse

#
#   Auto generated Apache configuration
#       @author: hyn/multi-tenant
#       @see: https://tenancy.dev
#       @time: {{ date('H:i:s d-m-Y') }}
#       @website id: {{ $website->id }}
#       @website uuid: {{ $website->uuid }}
#

@forelse($website->hostnames as $hostname)
    @include('tenancy.generators::webserver.apache.blocks.server', [
        'hostname' => $hostname,
        'website' => $website,
        'media' => $media
    ])
@empty
#
#   No hostnames found
#
@endforelse

Update domain in apache vhost template

Update domain in apache vhost template


<?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\Component\Security\Core\Tests\Util;

use Symfony\Component\Security\Core\Util\StringUtils;

class StringUtilsTest extends \PHPUnit_Framework_TestCase
{
    public function testEquals()
    {
        $this->assertTrue(StringUtils::equals('password', 'password'));
        $this->assertFalse(StringUtils::equals('password', 'foo'));
    }
}

<?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\Component\Security\Core\Tests\Util;

use Symfony\Component\Security\Core\Util\StringUtils;

/**
 * Data from PHP.net's hash_equals tests
 */
class StringUtilsTest extends \PHPUnit_Framework_TestCase
{
    public function dataProviderTrue()
    {
        return array(
            array('same', 'same'),
            array('', ''),
            array(123, 123),
            array(null, ''),
            array(null, null),
        );
    }

    public function dataProviderFalse()
    {
        return array(
            array('not1same', 'not2same'),
            array('short', 'longer'),
            array('longer', 'short'),
            array('', 'notempty'),
            array('notempty', ''),
            array(123, 'NaN'),
            array('NaN', 123),
            array(null, 123),
        );
    }

    /**
     * @dataProvider dataProviderTrue
     */
    public function testEqualsTrue($known, $user)
    {
        $this->assertTrue(StringUtils::equals($known, $user));
    }

    /**
     * @dataProvider dataProviderFalse
     */
    public function testEqualsFalse($known, $user)
    {
        $this->assertFalse(StringUtils::equals($known, $user));
    }
}

Add more tests for StringUtils::equals

[Security] Add more tests for StringUtils::equals


<?php

class TranslatableEditorToolbarExtension extends DataExtension {

	function updateLinkForm(&$form) {
		$field = new LanguageDropdownField('Language', _t('PageURLSelectionField.LANGUAGE', 'Language'));
		$field->setForm($form);
		$form->Fields()->insertBefore($field, 'internal');
		Requirements::javascript('translatable/javascript/HtmlEditorField.Translatable.js');
	}

}

<?php

class TranslatableEditorToolbarExtension extends DataExtension {

	function updateLinkForm(&$form) {
		$field = new LanguageDropdownField('Language', _t('CMSMain.LANGUAGEDROPDOWNLABEL', 'Language'));
		$field->setForm($form);
		$form->Fields()->insertBefore($field, 'internal');
		Requirements::javascript('translatable/javascript/HtmlEditorField.Translatable.js');
	}

}

Correct translation for language dropdown field in link form


<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20120925115659 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

        $this->addSql("ALTER TABLE TaskOutput ADD errorCount INT NOT NULL");
    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

        $this->addSql("ALTER TABLE TaskOutput DROP errorCount");
    }
}

<?php

namespace Application\Migrations;

use SimplyTestable\BaseMigrationsBundle\Migration\BaseMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20120925115659 extends BaseMigration
{
    public function up(Schema $schema)
    {
        $this->addCommonStatement('ALTER TABLE TaskOutput ADD errorCount INT NOT NULL');
        parent::up($schema);
    }

    public function down(Schema $schema)
    {
        $this->statements['mysql'] = array(
            "ALTER TABLE TaskOutput DROP errorCount"
        );

        $this->statements['sqlite'] = array(
            "SELECT 1 + 1"
        );

        parent::down($schema);
    }
}

Refactor previous migration, better code but shouldn't affect existing production db


<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\MainController;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserListController extends MainController
{
    public function index(Request $request)
    {
        $user = new User();
        $users = (Auth::user()->company_id == 1) ? $user->getAll() : getAllActiveByCompany(Auth::user()->company_id);
        $data['users'] = $users;

        return view('user.index', $data);
    }
}

<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\MainController;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserListController extends MainController
{
    public function index(Request $request)
    {
        $user = new User();
        $users = (Auth::user()->company_id == 1) ? $user->getAll() : $user->getAllActiveByCompany(Auth::user()->company_id);
        $data['users'] = $users;

        return view('user.index', $data);
    }
}

Fix user list for secondaries companies

Fix user list for secondaries companies


<?php

namespace Screamz\SecureDownloadBundle\Core\Exceptions;

use Screamz\SecureDownloadBundle\Core\Classes\DownloadRequest;
use Screamz\SecureDownloadBundle\Core\Classes\DownloadRequestError;

/**
 * Class DownloadRequestException
 *
 * This kind of exception is throw when download request error count is greater than 0, just before the exit point of the bundle (when the hash or the object is returned).
 *
 * The user will have to catch it in his own code.
 *
 * @see Screamz\SecureDownloadBundle\Core\Classes\ErrorCode
 *
 * @author Andréas HANSS <ahanss@kaliop.com>
 */
class DownloadRequestException extends \Exception
{
    /**
     * DownloadRequestException constructor.
     *
     * @param DownloadRequest $downloadRequest
     */
    public function __construct(DownloadRequest $downloadRequest)
    {
        $this->downloadRequest = $downloadRequest;
        parent::__construct('An '.__CLASS__.' has been thrown, please catch it to handle this error case.');
    }

    /**
     * Get the errors array, you can refer to error codes to handle different cases.
     *
     * @return DownloadRequestError[]
     *
     * @see Screamz\SecureDownloadBundle\Core\Classes\ErrorCode
     */
    public function getReasons()
    {
        return $this->downloadRequest->getErrors();
    }
}

<?php

namespace Screamz\SecureDownloadBundle\Core\Exceptions;

use Screamz\SecureDownloadBundle\Core\Classes\DownloadRequest;
use Screamz\SecureDownloadBundle\Core\Classes\DownloadRequestError;

/**
 * Class DownloadRequestException
 *
 * This kind of exception is throw when download request error count is greater than 0, just before the exit point of the bundle (when the hash or the object is returned).
 *
 * The user will have to catch it in his own code.
 *
 * @see Screamz\SecureDownloadBundle\Core\Classes\ErrorCode
 *
 * @author Andréas HANSS <ahanss@kaliop.com>
 */
class DownloadRequestException extends \Exception
{
    /**
     * DownloadRequestException constructor.
     *
     * @param DownloadRequest $downloadRequest
     */
    public function __construct(DownloadRequest $downloadRequest)
    {
        $this->downloadRequest = $downloadRequest;
        parent::__construct('An '.__CLASS__.' has been thrown, please catch it to handle this error case.');
    }

    /**
     * @inheritDoc
     */
    public function __toString()
    {
        $string = '';
        foreach ($this->downloadRequest->getErrors() as $error) {
            $string .= (string)$error . '|';
        }
        return $string;
    }

    /**
     * Get the errors array, you can refer to error codes to handle different cases.
     *
     * @return DownloadRequestError[]
     *
     * @see Screamz\SecureDownloadBundle\Core\Classes\ErrorCode
     */
    public function getReasons()
    {
        return $this->downloadRequest->getErrors();
    }
}

Add __tostring magic method for easier error dumping and debug


<?php
namespace CodeGen\Statement;
use CodeGen\Renderable;
use CodeGen\Line;

class RequireStatement extends Line implements Renderable
{
    public $expr;

    public function __construct(Renderable $expr) {
        $this->expr = $expr;
    }

    public function render(array $args = array()) {
        return 'require ' . $this->expr->render($args) . ';';
    }

}

<?php
namespace CodeGen\Statement;
use CodeGen\Renderable;
use CodeGen\Line;

class RequireStatement extends Statement implements Renderable
{
    public function __construct($file)
    {
        $this->expr = $file;
    }

    public function render(array $args = array()) {
        if ($this->expr instanceof Renderable) {
            return 'require ' . $this->expr->render($args) . ';';
        } else {
            return 'require ' . var_export($this->expr) . ';';
        }
    }

}

Fix require statement class for passing string as the file path


<?php
namespace NewRelic\Listener;

use Zend\EventManager\EventManagerInterface as Events;
use Zend\Mvc\MvcEvent;

class ResponseListener extends AbstractListener
{
    /**
     * @param  Events $events
     * @return void
     */
    public function attach(Events $events)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'onResponse'), 100);
    }

    /**
     * @param  MvcEvent $e
     * @return void
     */
    public function onResponse(MvcEvent $e)
    {
        if (!$this->options->getBrowserTimingEnabled()) {
            return;
        }

        if ($this->options->getBrowserTimingAutoInstrument()) {
            ini_set(
                'newrelic.browser_monitoring.auto_instrument',
                $this->options->getBrowserTimingAutoInstrument()
            );
            return;
        }

        $response = $e->getResponse();
        $content = $response->getContent();

        $browserTimingHeader = $this->client->getBrowserTimingHeader();
        $browserTimingFooter = $this->client->getBrowserTimingFooter();

        $content = str_replace('', '' . $browserTimingHeader, $content);
        $content = str_replace('', $browserTimingFooter . '', $content);

        $response->setContent($content);
    }
}

<?php
namespace NewRelic\Listener;

use Zend\EventManager\EventManagerInterface as Events;
use Zend\Mvc\MvcEvent;

class ResponseListener extends AbstractListener
{
    /**
     * @param  Events $events
     * @return void
     */
    public function attach(Events $events)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'onResponse'), 100);
    }

    /**
     * @param  MvcEvent $e
     * @return void
     */
    public function onResponse(MvcEvent $e)
    {
        if (!$this->options->getBrowserTimingEnabled()) {
            $this->client->disableAutorum();
            return;
        }

        if ($this->options->getBrowserTimingAutoInstrument()) {
            ini_set('newrelic.browser_monitoring.auto_instrument', true);
            return;
        }

        $response = $e->getResponse();
        $content = $response->getContent();

        $browserTimingHeader = $this->client->getBrowserTimingHeader();
        $browserTimingFooter = $this->client->getBrowserTimingFooter();

        $content = str_replace('', '' . $browserTimingHeader, $content);
        $content = str_replace('', $browserTimingFooter . '', $content);

        $response->setContent($content);
    }
}

Use disable autorum api call

Use disable autorum api call


<?php

/*
 * This file is part of StashServiceProvider
 *
 * (c) Ben Tollakson <btollakson.os@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bt51\Silex\Provider\StashServiceProvider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Stash\Pool;

class StashServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        if (! isset($app['stash.driver.class'])) {
            $app['stash.driver.class'] = 'Ephemeral';
        }

        $app['stash.driver'] = $app->share(function ($app) {
            $options = (isset($app['stash.driver.options']) ? $app['stash.driver.options'] : array());
            $class = sprintf('\\Stash\\Driver\\%s', $app['stash.driver.class']);
            $driver = new \ReflectionClass($class);
            return $driver->newInstanceArgs(array($options));
        });

        $app['stash'] = $app->share(function ($app) {
            return new Pool($app['stash.driver']);
        });
    }

    public function boot(Application $app)
    {

    }
}

<?php

/*
 * This file is part of StashServiceProvider
 *
 * (c) Ben Tollakson <btollakson.os@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bt51\Silex\Provider\StashServiceProvider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Stash\Pool;

class StashServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        if (! isset($app['stash.driver.class'])) {
            $app['stash.driver.class'] = 'Ephemeral';
        }

        $app['stash.driver'] = $app->share(function ($app) {
            $options = (isset($app['stash.driver.options']) ? $app['stash.driver.options'] : array());
            $class = sprintf('\\Stash\\Driver\\%s', $app['stash.driver.class']);
            $driver  = new $class;
            $driver->setOptions($options);
            return $driver;
        });

        $app['stash'] = $app->share(function ($app) {
            return new Pool($app['stash.driver']);
        });
    }

    public function boot(Application $app)
    {

    }
}

Fix to use setOptions() syntax

Fix to use setOptions() syntax


<?php

namespace Nacmartin\PhpExecJs\Runtime;

class V8jsRuntime implements RuntimeInterface
{
    /**
     * @var \V8Js
     * @access private
     */
    private $v8;

    /**
     * @var resource Our compiled context
     */
    public $context = null;

    public function __construct()
    {
        $this->v8 = new \V8Js();
    }

    /**
     * {@inheritdoc}
     */
    public function evalJs($code)
    {
        return $this->v8->executeString($code);
    }

    /**
     * {@inheritdoc}
     */
    public function call($function, $arguments = array())
    {
        return $this->evalJs($function.'.apply(this, '.json_encode($arguments).')');
    }

    /**
     * {@inheritdoc}
     */
    public function isAvailable()
    {
        return extension_loaded('v8js');
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return "V8js PHP Extension (V8)";
    }

    /**
     * {@inheritdoc}
     */
    public function createContext($code)
    {
        $this->context = $this->v8->compileString($code);
        $this->v8->executeScript($this->context);
    }

}

<?php

namespace Nacmartin\PhpExecJs\Runtime;

class V8jsRuntime implements RuntimeInterface
{
    /**
     * @var \V8Js
     * @access private
     */
    private $v8;

    /**
     * @var resource Our compiled context
     */
    public $context = null;

    public function __construct()
    {
        if ($this->isAvailable()) {
            $this->v8 = new \V8Js();
        }
    }

    /**
     * {@inheritdoc}
     */
    public function evalJs($code)
    {
        return $this->v8->executeString($code);
    }

    /**
     * {@inheritdoc}
     */
    public function call($function, $arguments = array())
    {
        return $this->evalJs($function.'.apply(this, '.json_encode($arguments).')');
    }

    /**
     * {@inheritdoc}
     */
    public function isAvailable()
    {
        return extension_loaded('v8js');
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return "V8js PHP Extension (V8)";
    }

    /**
     * {@inheritdoc}
     */
    public function createContext($code)
    {
        $this->context = $this->v8->compileString($code);
        $this->v8->executeScript($this->context);
    }

}

Check if v8js is available on construction of its runtime


<?php

/**
 * Decorates the {@link Member} object with extra fields needed for the SiteSprocket application
 *
 * @package SiteSprocket
 * @author Aaron Carlino
 */
class SiteSprocketMember extends DataObjectDecorator
{
	public function extraStatics() {
		return array (
			'db' => array (
				'Company' => 'Text',
				'City' => 'Text',
				'State' => 'Varchar(2)',
				'Address' => 'Text',
				'Zip' => 'Varchar(10)',
				'Phone' => 'Varchar(15)'
			),
			'has_one' => array (
				'Avatar' => 'Image'
			)
		);
	}

}

<?php

/**
 * Decorates the {@link Member} object with extra fields needed for the SiteSprocket application
 *
 * @package SiteSprocket
 * @author Aaron Carlino
 */
class SiteSprocketMember extends DataObjectDecorator
{
	public function extraStatics() {
		return array (
			'db' => array (
				'Company' => 'Text',
				'City' => 'Text',
				'State' => 'Varchar(2)',
				'Address' => 'Text',
				'Zip' => 'Varchar(10)',
				'Phone' => 'Varchar(15)'
			),
			'has_one' => array (
				'Avatar' => 'Image'
			),
			'has_many' => array (
				'Subscriptions' => 'SiteSprocketSubscription'
			)
		);
	}

}

ADD - Updates for ARB functionality

ADD - Updates for ARB functionality


<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use App\Models\Bookmark;
use Illuminate\View\View;

class BookmarksController extends Controller
{
    /**
     * Show the most recent bookmarks.
     *
     * @return View
     */
    public function index(): View
    {
        $bookmarks = Bookmark::latest()->with('tags')->withCount('tags')->paginate(10);

        return view('bookmarks.index', compact('bookmarks'));
    }

    /**
     * Show a single bookmark.
     *
     * @param  Bookmark  $bookmark
     * @return View
     */
    public function show(Bookmark $bookmark): View
    {
        $bookmark->loadMissing('tags');

        return view('bookmarks.show', compact('bookmark'));
    }

    /**
     * Show bookmakrs tagged with a specific tag.
     *
     * @param  string  $tag
     * @return View
     */
    public function tagged(string $tag): View
    {
        $bookmarks = Bookmark::whereHas('tags', function ($query) use ($tag) {
            $query->where('tag', $tag);
        })->latest()->with('tags')->withCount('tags')->paginate(10);

        return view('bookmarks.tagged', compact('bookmarks', 'tag'));
    }
}

<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use App\Models\Bookmark;
use Illuminate\View\View;

class BookmarksController extends Controller
{
    /**
     * Show the most recent bookmarks.
     *
     * @return View
     */
    public function index(): View
    {
        $bookmarks = Bookmark::latest()->with('tags')->withCount('tags')->paginate(10);

        return view('bookmarks.index', compact('bookmarks'));
    }

    /**
     * Show a single bookmark.
     *
     * @param  Bookmark  $bookmark
     * @return View
     */
    public function show(Bookmark $bookmark): View
    {
        $bookmark->loadMissing('tags');

        return view('bookmarks.show', compact('bookmark'));
    }

    /**
     * Show bookmarks tagged with a specific tag.
     *
     * @param  string  $tag
     * @return View
     */
    public function tagged(string $tag): View
    {
        $bookmarks = Bookmark::whereHas('tags', function ($query) use ($tag) {
            $query->where('tag', $tag);
        })->latest()->with('tags')->withCount('tags')->paginate(10);

        return view('bookmarks.tagged', compact('bookmarks', 'tag'));
    }
}

Fix a typo in a comment

Fix a typo in a comment


<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {
    $config->import('vendor/sylius-labs/coding-standard/ecs.php');

    $config->parallel();
    $config->paths(['src/Sylius']);
    $config->skip([
        InlineDocCommentDeclarationSniff::class . '.MissingVariable',
        InlineDocCommentDeclarationSniff::class . '.NoAssignment',
        VisibilityRequiredFixer::class => ['*Spec.php'],
        '**/var/*',
    ]);
    $config->ruleWithConfiguration(
        HeaderCommentFixer::class,
        [
            'location' => 'after_open',
            'comment_type' => HeaderCommentFixer::HEADER_COMMENT,
            'header' => <<<TEXT
This file is part of the Sylius package.

(c) Paweł Jędrzejewski

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
TEXT
        ]
    );
};

<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {
    $config->import('vendor/sylius-labs/coding-standard/ecs.php');

    $config->parallel();
    $config->paths(['src/Sylius']);
    $config->skip([
        InlineDocCommentDeclarationSniff::class . '.MissingVariable',
        InlineDocCommentDeclarationSniff::class . '.NoAssignment',
        VisibilityRequiredFixer::class => ['*Spec.php'],
        '**/var/*',
        'src/Sylius/Behat/Service/Converter/IriConverter.php',
    ]);
    $config->ruleWithConfiguration(
        HeaderCommentFixer::class,
        [
            'location' => 'after_open',
            'comment_type' => HeaderCommentFixer::HEADER_COMMENT,
            'header' => <<<TEXT
This file is part of the Sylius package.

(c) Paweł Jędrzejewski

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
TEXT
        ]
    );
};

[Maintenance] Exclude copied IRI converter in ECS config


<?php

namespace Faker\Provider\pl_PL;

class PhoneNumber extends \Faker\Provider\PhoneNumber
{
    protected static $formats = array(
        '+## ### ### ####',
        '### ### ###',
        '#########',
        '(##) ### ## ##',
        '+##(##)#######',
    );
}

Add more PL phone number

Add more PL phone number


<?php

namespace Finix\Resources;

use Finix\Hal\HrefSpec;
use Finix\Resource;

class InstrumentUpdate extends Resource
{
    public static function init()
    {
        self::getRegistry()->add(get_called_class(), new HrefSpec('payment_instruments/%s/updates', 'id', '/'));
    }
}

<?php

namespace Finix\Resources;

use Finix\Hal\HrefSpec;
use Finix\Resource;

class InstrumentUpdate extends Resource
{
    public static function init()
    {
        self::getRegistry()->add(get_called_class(), new HrefSpec('updates', 'id', '/'));
    }
}

Remove payment_instruments in updates root


<?php

use Phinx\Migration\AbstractMigration;

class RemovedProjectIdFromBuildMeta extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('build_meta');

        if ($table->hasColumn('project_id')) {
            $table
                ->removeColumn('project_id')
                ->save();
        }
    }

    public function down()
    {
        $table = $this->table('build_meta');

        if (!$table->hasColumn('project_id')) {
            $table
                ->addColumn('project_id', 'integer', ['default' => 0])
                ->save();
        }
    }
}

<?php

use Phinx\Migration\AbstractMigration;

class RemovedProjectIdFromBuildMeta extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('build_meta');

        if ($table->hasForeignKey('project_id')) {
            $table->dropForeignKey('project_id');
        }

        if ($table->hasColumn('project_id')) {
            $table
                ->removeColumn('project_id')
                ->save();
        }
    }

    public function down()
    {
        $table = $this->table('build_meta');

        if (!$table->hasColumn('project_id')) {
            $table
                ->addColumn(
                    'project_id',
                    'integer', [
                        'default' => 0,
                        'after' => 'id'
                    ]
                )
                ->addForeignKey('project_id', 'project', 'id', ['delete'=> 'CASCADE', 'update' => 'CASCADE'])
                ->save();
        }
    }
}

Fix Migrations | Installation Failed

Fix Migrations | Installation Failed


<?php
namespace Ratchet\WebSocket;
use Ratchet\AbstractConnectionDecorator;
use Ratchet\RFC6455\Messaging\DataInterface;
use Ratchet\RFC6455\Messaging\Frame;

/**
 * {@inheritdoc}
 * @property \StdClass $WebSocket
 */
class WsConnection extends AbstractConnectionDecorator {
    /**
     * {@inheritdoc}
     */
    public function send($msg, $isBinary = false) {
        if (!$this->WebSocket->closing) {
            if (!($msg instanceof DataInterface)) {
                $msg = new Frame($msg, true, ((boolean)$isBinary ? Frame::OP_BINARY : Frame::OP_TEXT));
            }

            $this->getConnection()->send($msg->getContents());
        }

        return $this;
    }

    /**
     * @param int|\Ratchet\RFC6455\Messaging\DataInterface
     */
    public function close($code = 1000) {
        if ($this->WebSocket->closing) {
            return;
        }

        if ($code instanceof DataInterface) {
            $this->send($code);
        } else {
            $this->send(new Frame(pack('n', $code), true, Frame::OP_CLOSE));
        }

        $this->getConnection()->close();

        $this->WebSocket->closing = true;
    }
}

<?php
namespace Ratchet\WebSocket;
use Ratchet\AbstractConnectionDecorator;
use Ratchet\RFC6455\Messaging\DataInterface;
use Ratchet\RFC6455\Messaging\Frame;

/**
 * {@inheritdoc}
 * @property \StdClass $WebSocket
 */
class WsConnection extends AbstractConnectionDecorator {
    /**
     * {@inheritdoc}
     */
    public function send($msg) {
        if (!$this->WebSocket->closing) {
            if (!($msg instanceof DataInterface)) {
                $msg = new Frame($msg);
            }

            $this->getConnection()->send($msg->getContents());
        }

        return $this;
    }

    /**
     * @param int|\Ratchet\RFC6455\Messaging\DataInterface
     */
    public function close($code = 1000) {
        if ($this->WebSocket->closing) {
            return;
        }

        if ($code instanceof DataInterface) {
            $this->send($code);
        } else {
            $this->send(new Frame(pack('n', $code), true, Frame::OP_CLOSE));
        }

        $this->getConnection()->close();

        $this->WebSocket->closing = true;
    }
}

Remove edited API for sending binary

Remove edited API for sending binary

(should pass message object instead)


<?php

namespace Assistant\Module\Common\Task;

use Monolog\Logger;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class AbstractTask extends Command
{
    public const IGNORED_PARAMETERS = [ 'help', 'ansi', 'no-ansi', 'no-interaction', 'quiet', 'verbose', 'version' ];

    protected InputInterface $input;
    protected OutputInterface $output;

    public function __construct(protected Logger $logger)
    {
        parent::__construct();
    }

    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        $this->logger->pushProcessor(function ($record) {
            $record['extra']['task'] = $this->getName();

            return $record;
        });
    }

    protected static function getInputParams(InputInterface $input): array
    {
        $params = array_merge($input->getArguments(), $input->getOptions());
        $withoutIgnoredParams = array_diff_key($params, array_flip(self::IGNORED_PARAMETERS));

        return $withoutIgnoredParams;
    }
}

<?php

namespace Assistant\Module\Common\Task;

use Monolog\Logger;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class AbstractTask extends Command
{
    public const IGNORED_PARAMETERS = [ 'help', 'ansi', 'no-ansi', 'no-interaction', 'quiet', 'verbose', 'version' ];

    protected InputInterface $input;
    protected OutputInterface $output;

    public function __construct(protected Logger $logger)
    {
        parent::__construct();
    }

    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        $this->logger->pushProcessor(function ($record) {
            $taskName = static::getDefaultName();

            $record['context']['command'] = $taskName;
            $record['extra']['task'] = $taskName;

            return $record;
        });
    }

    protected static function getInputParams(InputInterface $input): array
    {
        $params = array_merge($input->getArguments(), $input->getOptions());
        $withoutIgnoredParams = array_diff_key($params, array_flip(self::IGNORED_PARAMETERS));

        return $withoutIgnoredParams;
    }
}

:lipstick: Make background tasks always visible under their full name.


<?php namespace Cornford\Googlmapper\Facades;

use Illuminate\Support\Facades\Facade;

class Mapper extends Facade {

	protected static function getFacadeAccessor() { return 'mapper'; }

}

<?php namespace Cornford\Googlmapper\Facades;

use Illuminate\Support\Facades\Facade;

class MapperFacade extends Facade {

	protected static function getFacadeAccessor() { return 'mapper'; }

}

Change the class name to be as same as file name


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBusWatchListsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bus_watch_lists', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users');
            $table->integer('bus_stop_id');
            $table->string('name');
            $table->text('description');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('bus_watch_lists');
    }
}

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBusWatchListsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bus_watch_lists', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users');
            $table->string('bus_stop_id');
            $table->string('name');
            $table->text('description');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('bus_watch_lists');
    }
}

Stop ID should be string so zeros don't get truncated


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddResurrectCountToItems extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('items', function($table) {
            $table->integer('resurrect_count');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('items', function($table) {
            $table->dropColumn('resurrect_count');
        });
    }
}

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddResurrectCountToItems extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('items', function($table) {
            $table->integer('resurrect_count')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('items', function($table) {
            $table->dropColumn('resurrect_count');
        });
    }
}

Fix for resurrect_count default value in latest migration.


<?php

require_once(__DIR__.'/../../form/class.btc-form-textarea.php');

/**
 * @brief Renders a combination of a textarea and a descriptive text beforce.
 *
 */
class BTCWPSettingsFormTextarea {

/**
 * @brief Renders the HTML and prints it directly.
 *
 * @param string $id The HTML id attribute for the text input, this is also set as the name attribute.
 * @param string $desc Optional description, shown as label for the checkbox.
 * @return void
 */
	public static function render($id, $value = '', $desc = '', $rows = 0) {

		$descid = 'tagline-' . $id; // description id
		$aria = array('described-by' => $descid);

		$attrs = array('id' => $id, 'value' => $value, 'rows' => $rows, 'aria' => $aria, 'style' => 'width:100%', 'htmlClass' => 'large-text code');

		$textarea = new BTCFormTextarea($attrs, $value);

		if (!empty($desc)) {

			$out  = '
';
			$out .= $desc;
			$out .= '
';

			$out .= $textarea->render(false);

			echo $out;

		} else {

			$textarea->render();

		}

	}

}

?>

<?php

require_once(__DIR__.'/../../form/class.btc-form-textarea.php');

/**
 * @brief Renders a combination of a textarea and a descriptive text beforce.
 *
 */
class BTCWPSettingsFormTextarea {

/**
 * @brief Renders the HTML and prints it directly.
 *
 * @param string $id The HTML id attribute for the text input, this is also set as the name attribute.
 * @param string $desc Optional description, shown as label for the checkbox.
 * @return void
 */
	public static function render($id, $value = '', $desc = '', $rows = 0) {

		$descid = 'tagline-' . $id; // description id
		$aria = array('described-by' => $descid);

		$attrs = array('id' => $id, 'rows' => $rows, 'aria' => $aria, 'style' => 'width:100%', 'htmlClass' => 'large-text code');

		$textarea = new BTCFormTextarea($attrs, $value);

		if (!empty($desc)) {

			$out  = '
';
			$out .= $desc;
			$out .= '
';

			$out .= $textarea->render(false);

			echo $out;

		} else {

			$textarea->render();

		}

	}

}

?>

Fix WP Settings textarea template

Fix WP Settings textarea template

The value was inserted twice. One time inside the text area tags and
another time as value attribute.


<?php

namespace Oro\Bundle\TestFrameworkBundle\Provider;

use Oro\Bundle\EntityBundle\Provider\EntityAliasProviderInterface;

class EntityAliasProvider implements EntityAliasProviderInterface
{
    protected static $classes = [
        'Oro\Bundle\TestFrameworkBundle\Entity\Item',
        'Oro\Bundle\TestFrameworkBundle\Entity\ItemValue',
        'Oro\Bundle\TestFrameworkBundle\Entity\Product'
    ];

    /**
     * {@inheritdoc}
     */
    public function getEntityAlias($entityClass)
    {
        if (in_array($entityClass, self::$classes)) {
            return false;
        }

        return null;
    }
}

<?php

namespace Oro\Bundle\TestFrameworkBundle\Provider;

use Oro\Bundle\EntityBundle\Provider\EntityAliasProviderInterface;

/**
 * This alias provider excludes aliases generation for test entities to avoid duplications of aliases.
 * TestActivity entity does not covered by this class because it should have aliases.
 */
class EntityAliasProvider implements EntityAliasProviderInterface
{
    protected static $classes = [
        'Oro\Bundle\TestFrameworkBundle\Entity\Item',
        'Oro\Bundle\TestFrameworkBundle\Entity\ItemValue',
        'Oro\Bundle\TestFrameworkBundle\Entity\Product',
        'Oro\Bundle\TestFrameworkBundle\Entity\TestActivityTarget',
        'Oro\Bundle\TestFrameworkBundle\Entity\WorkflowAwareEntity',
    ];

    /**
     * {@inheritdoc}
     */
    public function getEntityAlias($entityClass)
    {
        if (in_array($entityClass, self::$classes)) {
            return false;
        }

        return null;
    }
}

Fix API requests for B2B instance

BAP-9408: Fix API requests for B2B instance


<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sylius\Component\Payment\Repository;

/**
 * @author Arnaud Langlade <arn0d.dev@gmail.com>
 */
interface PaymentMethodRepositoryInterface
{
    /**
     * @param array $options
     *
     * @return mixed
     */
    public function getQueryBuidlerForChoiceType(array $options);
}

<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sylius\Component\Payment\Repository;

/**
 * @author Arnaud Langlade <arn0d.dev@gmail.com>
 */
interface PaymentMethodRepositoryInterface
{
    /**
     * @param array $options
     *
     * @return mixed
     */
    public function getQueryBuilderForChoiceType(array $options);
}

Fix typo in PaymentMethodRepository method getQueryBuilderForChoiceType


<?php

namespace VideoHoster\Controller;

use VideoHoster\Tables\VideoTable;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class VideosController extends AbstractActionController
{
    protected $videoTable;

    public function __construct(VideoTable $videoTable)
    {
        $this->videoTable = $videoTable;
    }

    public function indexAction()
    {
        return new ViewModel();
    }

    public function ByCategoryAction()
    {
        return new ViewModel();
    }

    public function BySkillLevelAction()
    {
        return new ViewModel();
    }

    public function ViewVideoAction()
    {
        return new ViewModel();
    }

}

<?php

namespace VideoHoster\Controller;

use VideoHoster\Tables\VideoTable;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class VideosController extends AbstractActionController
{
    /**
     * Provides connection to the videos table in the database
     *
     * @var \VideoHoster\Tables\VideoTable videoTable
     * @access protected
     */
    protected $videoTable;

    /**
     *  Basic class constructor
     *
     * @param \VideoHoster\Tables\VideoTable $videoTable
     * @access public
     * @return void
     */
    public function __construct(VideoTable $videoTable)
    {
        $this->videoTable = $videoTable;
    }

    public function indexAction()
    {
        return new ViewModel();
    }

    public function ByCategoryAction()
    {
        return new ViewModel();
    }

    public function BySkillLevelAction()
    {
        return new ViewModel();
    }

    public function ViewVideoAction()
    {
        return new ViewModel();
    }

}

Make code more descriptive with some function comments


<?php

use OnlyBits\Connectors\WireAbstract;

class WireTest extends PHPUnit_Framework_TestCase
{
    public function testConnectionBetweenWires()
    {
        $wire1 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');
        $wire2 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');

        $wire1->expects($this->once())
             ->method('setValue')
             ->with($this->anything());

        $wire1->connect($wire2);
    }

    public function testWireIsReturned()
    {
        $wire1 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');
        $wire2 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');

        $wire = $wire1->connect($wire2);

        $this->assertInstanceOf('OnlyBits\Connectors\WireAbstract', $wire, "No instance of OnlyBits\Connectors\Wire was returned!");
    }
}

<?php

use OnlyBits\Connectors\WireAbstract;

class WireTest extends PHPUnit_Framework_TestCase
{
    public function testConnectionBetweenWires()
    {
        $wire1 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');
        $wire2 = $this->getMockForAbstractClass('OnlyBits\Connectors\WireAbstract');

        $wire1->expects($this->once())
             ->method('setValue')
             ->with($this->anything());

        $wire1->connect($wire2);
    }
}

Remove testWireIsReturned(). This test is no longer needed because the wire is no longer returned on connection.


<?php
declare(strict_types=1);

/**
 * This file is part of phpDocumentor.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author    Mike van Riel <mike.vanriel@naenius.com>
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      http://phpdoc.org
 */

namespace phpDocumentor\Application\Stage;

use phpDocumentor\Application\Configuration\CommandlineOptionsMiddleware;
use phpDocumentor\Application\Configuration\ConfigurationFactory;

final class Configure
{
    /**
     * @var ConfigurationFactory
     */
    private $configFactory;

    /**
     * Configure constructor.
     */
    public function __construct(ConfigurationFactory $configFactory)
    {
        $this->configFactory = $configFactory;
    }

    /**
     * @return string[]
     */
    public function __invoke(array $options): array
    {
        $this->configFactory->addMiddleware(
            new CommandlineOptionsMiddleware($options)
        );

        return $this->configFactory->fromDefaultLocations()->getArrayCopy();
    }
}

<?php
declare(strict_types=1);

/**
 * This file is part of phpDocumentor.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author    Mike van Riel <mike.vanriel@naenius.com>
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      http://phpdoc.org
 */

namespace phpDocumentor\Application\Stage;

use phpDocumentor\Application\Configuration\CommandlineOptionsMiddleware;
use phpDocumentor\Application\Configuration\ConfigurationFactory;
use phpDocumentor\DomainModel\Uri;

final class Configure
{
    /**
     * @var ConfigurationFactory
     */
    private $configFactory;

    /**
     * Configure constructor.
     */
    public function __construct(ConfigurationFactory $configFactory)
    {
        $this->configFactory = $configFactory;
    }

    /**
     * @return string[]
     */
    public function __invoke(array $options): array
    {
        $this->configFactory->addMiddleware(
            new CommandlineOptionsMiddleware($options)
        );

        if ($options['config'] ?? null) {
            return $this->configFactory->fromUri(new Uri(realpath($options['config'])))->getArrayCopy();
        }

        return $this->configFactory->fromDefaultLocations()->getArrayCopy();
    }
}

Load configuration from a custom location


<?php
$installer = $this;
$installer->startSetup();

$installer->run("
    ALTER TABLE {$this->getTable('slideshow/slideshow')}
        ADD `from_date` datetime NULL default NULL,
        ADD `to_date` datetime NULL default NULL;
    ");
$installer->endSetup();

<?php

$this->startSetup();
$this->getConnection()->addColumn(
    $this->getTable('slideshow/slideshow'),
    'from_date',
    'datetime NULL default NULL'
);

$this->getConnection()->addColumn(
    $this->getTable('slideshow/slideshow'),
    'to_date',
    'datetime NULL default NULL'
);

$this->endSetup();

Change sql query to check if table already exist

Change sql query to check if table already exist


<?php

/*
Copyright (C) 2016 Teclib'

This file is part of Armadito Plugin for GLPI.

Armadito Plugin for GLPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Armadito Plugin for GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Armadito Plugin for GLPI. If not, see <http://www.gnu.org/licenses/>.

**/

class AgentFormTest extends CommonTestCase
{
    /**
     * @test
     */
    public function showForms()
    {
        ob_start();

        $agent = new PluginArmaditoAgent();
        $agent->showForm(2);
        $agent->showForm(3);

        ob_end_clean();
    }
}

<?php

/*
Copyright (C) 2016 Teclib'

This file is part of Armadito Plugin for GLPI.

Armadito Plugin for GLPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Armadito Plugin for GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Armadito Plugin for GLPI. If not, see <http://www.gnu.org/licenses/>.

**/

class AgentFormTest extends CommonTestCase
{
    /**
     * @test
     */
    public function showForms()
    {
        ob_start();

        $agent = new PluginArmaditoAgent();
        $agent->showForm(2);
        $agent->showForm(3);

        PluginArmaditoAgent::showNewScanForm();

        ob_end_clean();
    }
}

Add showNewScanForm to it tests

Add showNewScanForm to it tests


<?php if($well): ?>
<?php endif; ?>

Felix

<?php if($well): ?>
<?php endif; ?>

Hide Facebook box on small screens

Hide Facebook box on small screens


@extends('layout.layout')

@section('content')

            <form class="ui form">

                    Your email adress
                    <input type="text" name="email" placeholder="The email adress you used to create the ad">

                    <button class="ui red submit button" type="submit">Submit</button>

            </form>

            @include('ads.elements.notifications')

@stop

@extends('layout.layout')

@section('content')

            We will send you a mail containing your secret connection link.

            <form class="ui form">

                    Your email adress
                    <input type="text" name="email" placeholder="The email adress you used to create the ad">

                    <button class="ui red submit button" type="submit">Submit</button>

            </form>

            @include('ads.elements.notifications')

@stop

Add small message for forgotten link

Add small message for forgotten link


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProjectUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('project_user', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('project_user');
    }
}

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProjectUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('project_user', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('project_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('project_user');
    }
}

Fix migration error 'project_id' doesn't exist


<?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       Cake.Model.Behavior
 * @since         CakePHP(tm) v 1.2.0.4525
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Model;

/**
 * A model used by TranslateBehavior to access the translation tables.
 *
 * @package Cake.Model
 */
class I18nModel extends AppModel {

/**
 * Model name
 *
 * @var string
 */
	public $name = 'I18nModel';

/**
 * Table name
 *
 * @var string
 */
	public $useTable = 'i18n';

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'field';

}

<?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       Cake.Model.Behavior
 * @since         CakePHP(tm) v 1.2.0.4525
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Model;

/**
 * A model used by TranslateBehavior to access the translation tables.
 *
 * @package Cake.Model
 */
class I18nModel extends Model {

/**
 * Model name
 *
 * @var string
 */
	public $name = 'I18nModel';

/**
 * Table name
 *
 * @var string
 */
	public $useTable = 'i18n';

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'field';

}

Fix inheritance to use a class that exists.


<?php
/**
 * This is the output for an event listing in icalendar format.
 * @package UNL_UCBCN_Frontend
 */
UNL_UCBCN::display($this->events);
?>

<?php
/**
 * This is the output for an event listing in icalendar format.
 * @package UNL_UCBCN_Frontend
 */
UNL_UCBCN::displayRegion($this->events);
?>

Fix error, displayRegion instead of display


<?php namespace PopcornPHP\RedirectToHTTPS;

use System\Classes\PluginBase;

class Plugin extends PluginBase
{
    public function pluginDetails()
    {
        return [
            'name'        => 'RedirectToHTTPS',
            'description' => 'Simple plugin for redirect all request to HTTPS',
            'author'      => 'Alexander Shapoval',
            'icon'        => 'icon-exchange',
        ];
    }

    public function boot()
    {
        $this->app['Illuminate\Contracts\Http\Kernel']
            ->prependMiddleware('PopcornPHP\RedirectToHTTPS\Classes\HTTPSMiddleware');
    }
}

<?php namespace PopcornPHP\RedirectToHTTPS;

use System\Classes\PluginBase;

class Plugin extends PluginBase
{
    public function pluginDetails()
    {
        return [
            'name'        => 'RedirectToHTTPS',
            'description' => 'Simple plugin for redirect all request to HTTPS',
            'author'      => 'Alexander Shapoval',
            'icon'        => 'icon-exchange',
            'homepage'    => 'https://github.com/PopcornPHP/oc-redirect-to-https'
        ];
    }

    public function boot()
    {
        $this->app['Illuminate\Contracts\Http\Kernel']
            ->prependMiddleware('PopcornPHP\RedirectToHTTPS\Classes\HTTPSMiddleware');
    }
}

Add homepage to plugin details

Add homepage to plugin details


<?php

class Spelling extends CActiveRecord {
	const WORD_PATTERN = '/\b[а-яё]+\b/iu';

	public static function model($class_name = __CLASS__) {
		return parent::model($class_name);
	}

	public function tableName() {
		return '{{spellings}}';
	}

	public function rules() {
		return array(
			array('word', 'match', 'pattern' => Spelling::WORD_PATTERN),
			array('word', 'unique'),
			array('word', 'length', 'min' => 1)
		);
	}
}

<?php

class Spelling extends CActiveRecord {
	const WORD_PATTERN = '/\b[a-zа-яё]+\b/iu';

	public static function model($class_name = __CLASS__) {
		return parent::model($class_name);
	}

	public function tableName() {
		return '{{spellings}}';
	}

	public function rules() {
		return array(
			array('word', 'match', 'pattern' => Spelling::WORD_PATTERN),
			array('word', 'unique'),
			array('word', 'length', 'min' => 1)
		);
	}
}

Add the Latin characters into the word pattern for spelling checking


<?php

declare(strict_types=1);

namespace Overblog\GraphQLBundle\Tests\EventListener;

use GraphQL\Error\Error;
use Overblog\GraphQLBundle\Error\InvalidArgumentError;
use Overblog\GraphQLBundle\Error\InvalidArgumentsError;
use Overblog\GraphQLBundle\Event\ErrorFormattingEvent;
use Overblog\GraphQLBundle\EventListener\ValidationErrorsListener;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;

class ValidationErrorsListenerTest extends TestCase
{
    /** @var ErrorLoggerListener */
    private $listener;

    /** @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */
    private $logger;

    public function setUp(): void
    {
        $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
        $this->listener = new ValidationErrorsListener($this->logger);
    }

    public function testOnErrorFormatting(): void
    {
        $invalidArguments = new InvalidArgumentsError([new InvalidArgumentError('invalid', new ConstraintViolationList([new ConstraintViolation('message', 'error_template', [], '', 'prop1', 'invalid')]))]);
        $formattedError = [];
        $event = new ErrorFormattingEvent(Error::createLocatedError($invalidArguments), $formattedError);
        $this->listener->onErrorFormatting($event);

        $this->assertEquals($event->getFormattedError()->getArrayCopy(), ['state' => ['invalid' => [0 => ['path' => 'prop1', 'message' => 'message', 'code' => null]]]]);
    }
}

<?php

declare(strict_types=1);

namespace Overblog\GraphQLBundle\Tests\EventListener;

use GraphQL\Error\Error;
use Overblog\GraphQLBundle\Error\InvalidArgumentError;
use Overblog\GraphQLBundle\Error\InvalidArgumentsError;
use Overblog\GraphQLBundle\Event\ErrorFormattingEvent;
use Overblog\GraphQLBundle\EventListener\ValidationErrorsListener;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;

class ValidationErrorsListenerTest extends TestCase
{
    /** @var ValidationErrorsListener */
    private $listener;

    public function setUp(): void
    {
        $this->listener = new ValidationErrorsListener();
    }

    public function testOnErrorFormatting(): void
    {
        $invalidArguments = new InvalidArgumentsError([new InvalidArgumentError('invalid', new ConstraintViolationList([new ConstraintViolation('message', 'error_template', [], '', 'prop1', 'invalid')]))]);
        $formattedError = [];
        $event = new ErrorFormattingEvent(Error::createLocatedError($invalidArguments), $formattedError);
        $this->listener->onErrorFormatting($event);

        $this->assertEquals($event->getFormattedError()->getArrayCopy(), ['state' => ['invalid' => [0 => ['path' => 'prop1', 'message' => 'message', 'code' => null]]]]);
    }
}

Fix validation error listener test

Fix validation error listener test


<?php

final class PholioMockDescriptionTransaction
  extends PholioMockTransactionType {

  const TRANSACTIONTYPE = 'description';

  public function generateOldValue($object) {
    return $object->getDescription();
  }

  public function applyInternalEffects($object, $value) {
    $object->setDescription($value);
  }

  public function getTitle() {
    return pht(
      "%s updated the mock's description.",
      $this->renderAuthor());
  }

  public function getTitleForFeed() {
    return pht(
      '%s updated the description for %s.',
      $this->renderAuthor(),
      $this->renderObject());
  }

  public function shouldHide() {
    $old = $this->getOldValue();
    return ($old === null);
  }

  public function hasChangeDetailView() {
    return true;
  }

  public function newChangeDetailView() {
    $viewer = $this->getViewer();

    return id(new PhabricatorApplicationTransactionTextDiffDetailView())
      ->setViewer($viewer)
      ->setOldText($this->getOldValue())
      ->setNewText($this->getNewValue());
  }

}

<?php

final class PholioMockDescriptionTransaction
  extends PholioMockTransactionType {

  const TRANSACTIONTYPE = 'description';

  public function generateOldValue($object) {
    return $object->getDescription();
  }

  public function applyInternalEffects($object, $value) {
    $object->setDescription($value);
  }

  public function getTitle() {
    return pht(
      "%s updated the mock's description.",
      $this->renderAuthor());
  }

  public function getTitleForFeed() {
    return pht(
      '%s updated the description for %s.',
      $this->renderAuthor(),
      $this->renderObject());
  }

  public function shouldHide() {
    $old = $this->getOldValue();
    return ($old === null);
  }

  public function hasChangeDetailView() {
    return true;
  }

  public function newChangeDetailView() {
    $viewer = $this->getViewer();

    return id(new PhabricatorApplicationTransactionTextDiffDetailView())
      ->setViewer($viewer)
      ->setOldText($this->getOldValue())
      ->setNewText($this->getNewValue());
  }

  public function newRemarkupChanges() {
    $changes = array();

    $changes[] = $this->newRemarkupChange()
      ->setOldValue($this->getOldValue())
      ->setNewValue($this->getNewValue());

    return $changes;
  }

}

Make Pholio description behave as a remarkup field (e.g., subscribe mentioned users)

Summary: Ref T12732. This is pre-existing but fix it since I caught it while banging around.

Test Plan: {F4967442}

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12732

Differential Revision: https://secure.phabricator.com/D17970


<?php namespace Nord\Lumen\Doctrine\ORM\Console;

use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Symfony\Component\Console\Input\InputOption;

class FixturesLoadCommand extends DoctrineCommand
{

    /**
     * @var string
     */
    protected $name = 'doctrine:fixtures:load';

    /**
     * @var string
     */
    protected $description = 'Loads data fixtures into the database';

    /**
     * @inheritdoc
     */
    public function fire()
    {
        $loader = new Loader();

        $this->info('Loading fixtures ...');

        $loader->loadFromDirectory($this->option('path'));

        $fixtures = $loader->getFixtures();

        $purger   = new ORMPurger();
        $executor = new ORMExecutor($this->getEntityManager(), $purger);
        $executor->execute($fixtures);

        $this->info('Fixtures loaded!');
    }

    /**
     * @return array
     */
    protected function getOptions()
    {
        return [
            ['path', false, InputOption::VALUE_REQUIRED, 'Path to fixtures.'],
        ];
    }
}

<?php namespace Nord\Lumen\Doctrine\ORM\Console;

use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Symfony\Component\Console\Input\InputOption;

class FixturesLoadCommand extends DoctrineCommand
{

    /**
     * @var string
     */
    protected $name = 'doctrine:fixtures:load';

    /**
     * @var string
     */
    protected $description = 'Loads data fixtures into the database';

    /**
     * @inheritdoc
     */
    public function fire()
    {
        $loader = new Loader();

        $this->info('Loading fixtures ...');

        $loader->loadFromDirectory($this->option('path'));

        $fixtures = $loader->getFixtures();

        $purger   = new ORMPurger();
        $executor = new ORMExecutor($this->getEntityManager(), $purger);
        $executor->execute($fixtures, $this->option('append'));

        $this->info('Fixtures loaded!');
    }

    /**
     * @return array
     */
    protected function getOptions()
    {
        return [
            ['path', null, InputOption::VALUE_REQUIRED, 'Path to fixtures.'],
            ['append', true, InputOption::VALUE_OPTIONAL, 'Whether to append fixtures and preserve the database.'],
        ];
    }
}

Add support for appending fixtures

Add support for appending fixtures


<?php

namespace WP_CLI\Fetchers;

class User extends Base {

	protected $msg = "Invalid user ID or login: '%s'";

	public function get( $id_or_login ) {
		if ( is_numeric( $id_or_login ) )
			$user = get_user_by( 'id', $id_or_login );
		else
			$user = get_user_by( 'login', $id_or_login );

		return $user;
	}
}

<?php

namespace WP_CLI\Fetchers;

class User extends Base {

	protected $msg = "Invalid user ID, email or login: '%s'";

	public function get( $id_email_or_login ) {

		if ( is_email( $id_email_or_login ) )
			$user = get_user_by( 'email', $id_email_or_login );
		else if ( is_numeric( $id_email_or_login ) )
			$user = get_user_by( 'id', $id_email_or_login );
		else
			$user = get_user_by( 'login', $id_email_or_login );

		return $user;
	}
}

Support for `user_email` as a third type of argument that can be passed to `<user>`


<?php
// Grab the "Global" settings from drupdates
$result = json_decode(exec('python ~/.drush/settings.py'), true);
$path = $result['workingDir']['value'];
$driver = $result['datastoreDriver']['value'];
$user = $result['datastoreSuperUser']['value'];
$pass = $result['datastoreSuperPword']['value'];
$port = $result['datastorePort']['value'];
$host = $result['datastoreHost']['value'];
$webroot = $result['webrootDir']['value'];

// I'm not sure why but if you keep $result populated you get ghost aliases who
// values are the same as the $result array elelment names
$result = array();
$aliases = array();
$dir_handle = new DirectoryIterator($path);
while($dir_handle->valid()) {
  if($dir_handle->isDir() && !$dir_handle->isDot()) {
    $basename = $dir_handle->getBasename();
    $root = $dir_handle->getPathname();
    $root = $webroot != "" ? $root : $root . $webroot;
    $aliases[$basename] = array(
      'uri' => 'http://localhost/' . $basename,
      'root' => $root,
      'databases' => array(
        'default' => array(
          'default' => array(
            'driver' => $driver,
            'username' => $basename . '_user',
            'password' => $basename . '_pass',
            'port' => $port,
            'host' => $host,
            'database' => $basename,
          ),
        ),
      ),
    );
  }
  $dir_handle->next();
}

<?php
// Grab the datastore settings from drupdates
$result = json_decode(exec('python ~/.drush/settings.py'), true);
$path = $result['workingDir']['value'];
$driver = $result['datastoreDriver']['value'];
$user = $result['datastoreSuperUser']['value'];
$pass = $result['datastoreSuperPword']['value'];
$port = $result['datastorePort']['value'];
$host = $result['datastoreHost']['value'];
$webroot = $result['webrootDir']['value'];

// I'm not sure why but if you keep $result populated you get ghost aliases who
// values are the same as the $result array elelment names
$result = array();
$aliases = array();
$dir_handle = new DirectoryIterator($path);
while($dir_handle->valid()) {
  if($dir_handle->isDir() && !$dir_handle->isDot()) {
    $basename = $dir_handle->getBasename();
    $root = $dir_handle->getPathname();
    $root = $webroot != "" ? $root : $root . $webroot;
    $aliases[$basename] = array(
      'uri' => 'http://localhost/' . $basename,
      'root' => $root,
      'databases' => array(
        'default' => array(
          'default' => array(
            'driver' => $driver,
            'username' => $basename . '_user',
            'password' => $basename . '_pass',
            'port' => $port,
            'host' => $host,
            'database' => $basename,
          ),
        ),
      ),
    );
  }
  $dir_handle->next();
}

Fix comment in aliases php script

Fix comment in aliases php script


@if ($paginator->getLastPage() > 1)

				@if ($paginator->getCurrentPage() <= 1)

«

				@else

{{ link_to($paginator->getUrl($paginator->getCurrentPage() - 1), '«') }}

				@endif

				@for ($page = 1; $page <= $paginator->getLastPage(); $page++)
					@if ($paginator->getCurrentPage() == $page)

{{ $page }}

					@else

{{ link_to($paginator->getUrl($page), $page) }}

					@endif
				@endfor

				@if ($paginator->getCurrentPage() >= $paginator->getLastPage())

»

				@else

{{ link_to($paginator->getUrl($paginator->getCurrentPage() + 1), '»') }}

				@endif

@endif

{? $presenter = new Illuminate\Pagination\BootstrapPresenter($paginator) ?}

@if ($paginator->getLastPage() > 1)

				{{ $presenter->render() }}

@endif

Use the slider template for pagination

Use the slider template for pagination


<?php

use App\Models\StaticArchive\Site;
use App\Models\Collections\Artwork;
use App\Models\Collections\Exhibition;

class SitesTableSeeder extends AbstractSeeder
{

    protected function seed()
    {

        factory( Site::class, 25 )->create();

        $this->seedRelation( Site::class, Artwork::class, 'artworks' );

        $sites = Site::fake()->get();
        $exhibitionIds = Exhibition::fake()->pluck('citi_id')->all();

        foreach ($sites as $site) {

            $exhibitionId = $exhibitionIds[array_rand($exhibitionIds)];

            $site->exhibition_id = $exhibitionId;

        }

    }

}

<?php

use App\Models\StaticArchive\Site;
use App\Models\Collections\Artwork;
use App\Models\Collections\Exhibition;

class SitesTableSeeder extends AbstractSeeder
{

    protected function seed()
    {

        factory( Site::class, 25 )->create();

        $this->seedRelation( Site::class, Artwork::class, 'artworks' );

        $this->seedRelation( Site::class, Exhibition::class, 'exhibition' );

    }

}

Fix SiteTableSeeder to use seedRelation

Fix SiteTableSeeder to use seedRelation


<?php

namespace Auth0\Login;

use Auth0\Login\Contract\Auth0UserRepository;
use Illuminate\Routing\Controller;

class Auth0Controller extends Controller
{
    /**
     * @var Auth0UserRepository
     */
    protected $userRepository;

    /**
     * Auth0Controller constructor.
     *
     * @param Auth0UserRepository $userRepository
     */
    public function __construct(Auth0UserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }

    /**
     * Callback action that should be called by auth0, logs the user in.
     */
    public function callback()
    {
        // Get a handle of the Auth0 service (we don't know if it has an alias)
        $service = \App::make('auth0');

        // Try to get the user information
        $profile = $service->getUser();

        // Get the user related to the profile
        $auth0User = $this->userRepository->getUserByUserInfo($profile);

        if ($auth0User) {
            // If we have a user, we are going to log him in, but if
            // there is an onLogin defined we need to allow the Laravel developer
            // to implement the user as he wants an also let him store it.
            if ($service->hasOnLogin()) {
                $user = $service->callOnLogin($auth0User);
            } else {
                // If not, the user will be fine
                $user = $auth0User;
            }
            \Auth::login($user, $service->rememberUser());
        }

        return \Redirect::intended('/');
    }
}

<?php

namespace Auth0\Login;

use Auth0\Login\Contract\Auth0UserRepository;
use Illuminate\Routing\Controller;

class Auth0Controller extends Controller
{
    /**
     * @var Auth0UserRepository
     */
    protected $userRepository;

    /**
     * Auth0Controller constructor.
     *
     * @param Auth0UserRepository $userRepository
     */
    public function __construct(Auth0UserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }

    /**
     * Callback action that should be called by auth0, logs the user in.
     */
    public function callback()
    {
        // Get a handle of the Auth0 service (we don't know if it has an alias)
        $service = \App::make('auth0');

        // Try to get the user information
        $profile = $service->getUser();

        // Get the user related to the profile
        $auth0User = $this->userRepository->getUserByUserInfo($profile);

        if ($auth0User) {
            // If we have a user, we are going to log them in, but if
            // there is an onLogin defined we need to allow the Laravel developer
            // to implement the user as he wants an also let them store it.
            if ($service->hasOnLogin()) {
                $user = $service->callOnLogin($auth0User);
            } else {
                // If not, the user will be fine
                $user = $auth0User;
            }
            \Auth::login($user, $service->rememberUser());
        }

        return \Redirect::intended('/');
    }
}

Make code comments gender neutral

Make code comments gender neutral

Replaces gendered references to users with a neutral 'them'.


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRoundsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rounds', function (Blueprint $table)
        {
            $table->increments('id');
            $table->string('name', 64);
            $table->string('description');
            $table->decimal('budget', 8, 2);
            $table->decimal('min_request_amount', 8, 2);
            $table->decimal('max_request_amount', 8, 2);
            $table->date('start_date');
            $table->date('end_date');
            $table->timestamps();
        });

        Schema::table('applications', function (Blueprint $table)
        {
            $table->integer('round_id')->unsigned();
            $table->foreign('round_id')->references('id')->on('rounds');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('applications', function (Blueprint $table)
        {
            $table->dropForeign('round_id');
            $table->dropColumn('round_id');
        });

        Schema::drop('rounds');
    }
}

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRoundsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rounds', function (Blueprint $table)
        {
            $table->increments('id');
            $table->string('name', 64);
            $table->string('description');
            $table->decimal('budget', 8, 2);
            $table->decimal('min_request_amount', 8, 2);
            $table->decimal('max_request_amount', 8, 2);
            $table->date('start_date');
            $table->date('end_date');
            $table->timestamps();
        });

        DB::statement('SET FOREIGN_KEY_CHECKS = 0');

        Schema::table('applications', function (Blueprint $table)
        {
            $table->integer('round_id')->unsigned();
            $table->foreign('round_id')->references('id')->on('rounds');
        });

        DB::statement('SET FOREIGN_KEY_CHECKS = 1');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS = 0');

        Schema::table('applications', function (Blueprint $table)
        {
            $table->dropForeign('round_id');
            $table->dropColumn('round_id');
        });

        Schema::drop('rounds');

        DB::statement('SET FOREIGN_KEY_CHECKS = 1');
    }
}

Disable foreign key checks when creating round_id column


<?php namespace FireflyIII\Http\Controllers;

use FireflyIII\Helpers\Help\HelpInterface;
use Log;
use Preferences;
use Response;

/**
 * Class HelpController
 *
 * @package FireflyIII\Http\Controllers
 */
class HelpController extends Controller
{
    /**
     * HelpController constructor.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * @param HelpInterface $help
     * @param               $route
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function show(HelpInterface $help, string $route)
    {
        $content = [
            'text'  => '
There is no help for this route!
',
            'title' => 'Help',
        ];

        if (!$help->hasRoute($route)) {
            Log::error('No such route: ' . $route);

            return Response::json($content);
        }

        if ($help->inCache($route)) {
            $content = [
                'text'  => $help->getFromCache('help.' . $route . '.text'),
                'title' => $help->getFromCache('help.' . $route . '.title'),
            ];

            return Response::json($content);
        }
        $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
        $content  = $help->getFromGithub($language, $route);

        $help->putInCache($route, $content);

        return Response::json($content);

    }

}

<?php namespace FireflyIII\Http\Controllers;

use FireflyIII\Helpers\Help\HelpInterface;
use Log;
use Preferences;
use Response;

/**
 * Class HelpController
 *
 * @package FireflyIII\Http\Controllers
 */
class HelpController extends Controller
{
    /**
     * HelpController constructor.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * @param HelpInterface $help
     * @param               $route
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function show(HelpInterface $help, string $route)
    {
        $content = [
            'text'  => '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>',
            'title' => 'Help',
        ];

        if (!$help->hasRoute($route)) {
            Log::error('No such route: ' . $route);

            return Response::json($content);
        }

        if ($help->inCache($route)) {
            $content = [
                'text'  => $help->getFromCache('help.' . $route . '.text'),
                'title' => $help->getFromCache('help.' . $route . '.title'),
            ];

            return Response::json($content);
        }
        $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
        Log::debug('Will get help from Github for language "' . $language . '" and route "' . $route . '".');
        $content = $help->getFromGithub($language, $route);

        $help->putInCache($route, $content);

        return Response::json($content);

    }

}

Fix help text and debug.

Fix help text and debug.


<?php

namespace Webfactory\ContentMapping\Test\Stubs;

use Webfactory\ContentMapping\SourceAdapter;

class SourceStub implements SourceAdapter
{
    /**
     * @var \Iterator
     */
    private $objects;

    /**
     * @param $objects
     */
    public function __construct(\Iterator $objects = null)
    {
        $this->objects = $objects ?: new \ArrayIterator();
    }

    public function getObjectsOrderedById()
    {
        usort($entities, function($a, $b) {
            return $a->getId() <=> $b->getId();
        });

        return $this->objects;
    }
}

<?php

namespace Webfactory\ContentMapping\Test\Stubs;

use Webfactory\ContentMapping\SourceAdapter;

class SourceStub implements SourceAdapter
{
    /**
     * @var \Iterator
     */
    private $objects;

    /**
     * @param $objects
     */
    public function __construct(\Iterator $objects = null)
    {
        $this->objects = $objects ?: new \ArrayIterator();
    }

    public function getObjectsOrderedById()
    {
        return $this->objects;
    }
}

Revert "Ensure objects are sorted by ID when calling getObjectsOrderedById()"

This reverts commit 31b3611813b22f9e981836682583807503c5c1ce.


<?php

namespace Mockery\Generator\StringManipulation\Pass;

use Mockery as m;
use Mockery\Generator\StringManipulation\Pass\ClassNamePass;
use Mockery\Generator\MockConfiguration;

class ClassNamePassTest extends \PHPUnit_Framework_TestCase
{
    const CODE = "namespace Mockery; class Mock {}";

    public function setup()
    {
       $this->pass = new ClassNamePass();
    }

    /**
     * @test
     */
    public function shouldRemoveNamespaceDefinition()
    {
        $config = new MockConfiguration;
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertNotContains('namespace Mockery;', $code);
    }

    /**
     * @test
     */
    public function shouldReplaceNamespaceIfClassNameIsNamespaced()
    {
        $config = new MockConfiguration();
        $config->setName("Dave\Dave");
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertNotContains('namespace Mockery;', $code);
        $this->assertContains('namespace Dave;', $code);
    }

    /**
     * @test
     */
    public function shouldReplaceClassNameWithSpecifiedName()
    {
        $config = new MockConfiguration();
        $config->setName("Dave");
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertContains('class Dave', $code);
    }

    /**
     * @test
     */
    public function shouldReplaceClassNameWithGeneratedNameIfNotSpecified()
    {
        $config = m::mock("Mockery\Generator\MockConfiguration", array(
            "generateName" => "Dave",
        ))->shouldIgnoreMissing();
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertContains('class Dave', $code);
    }
}

<?php

namespace Mockery\Generator\StringManipulation\Pass;

use Mockery as m;
use Mockery\Generator\StringManipulation\Pass\ClassNamePass;
use Mockery\Generator\MockConfiguration;

class ClassNamePassTest extends \PHPUnit_Framework_TestCase
{
    const CODE = "namespace Mockery; class Mock {}";

    public function setup()
    {
       $this->pass = new ClassNamePass();
    }

    /**
     * @test
     */
    public function shouldRemoveNamespaceDefinition()
    {
        $config = new MockConfiguration;
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertNotContains('namespace Mockery;', $code);
    }

    /**
     * @test
     */
    public function shouldReplaceNamespaceIfClassNameIsNamespaced()
    {
        $config = new MockConfiguration();
        $config->setName("Dave\Dave");
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertNotContains('namespace Mockery;', $code);
        $this->assertContains('namespace Dave;', $code);
    }

    /**
     * @test
     */
    public function shouldReplaceClassNameWithSpecifiedName()
    {
        $config = new MockConfiguration();
        $config->setName("Dave");
        $code = $this->pass->apply(static::CODE, $config);
        $this->assertContains('class Dave', $code);
    }
}

Remove redundant and incorrect test

Remove redundant and incorrect test


    <?php
    /* translators: %s: Name of current post */
    echo apply_filters('the_content', $post->post_content);
//                    the_content(sprintf(
//                                    __('Continue reading "%s"', 'twentyseventeen'), get_the_title()
//                    ));

    wp_link_pages(array(
        'before' => '
' . sprintf('
%s
', __('Page', 'twentyseventeen')),
        'after' => '
',
        'link_before' => '',
        'link_after' => '',
    ));
    ?>

    <?php

    if (is_page()):
        echo apply_filters('the_content', $post->post_content);
    else:
        the_content();
    endif;

    wp_link_pages(array(
        'before' => '
' . sprintf('
%s
', __('Page', 'twentyseventeen')),
        'after' => '
',
        'link_before' => '',
        'link_after' => '',
    ));

    ?>

Load different content for pages and posts


<?php namespace Znck\Repositories\Exceptions;

use Symfony\Component\Translation\Exception\NotFoundResourceException as SymfonyNotFoundResourceException;

class NotFoundResourceException extends SymfonyNotFoundResourceException
{
}

<?php namespace Znck\Repositories\Exceptions;

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class NotFoundResourceException extends NotFoundHttpException
{

}

Throw http 404 exception if not found

Throw http 404 exception if not found


<?php

namespace Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

class Builder implements ContainerAwareInterface
{
    use ContainerAwareTrait;

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $menu = $factory->createItem('root');

        $menu->addChild('Services', array('route' => 'entity_list'));

        $menu->addChild('Registration', array(
            'uri' => '/',
        ));

        return $menu;
    }
}

<?php

namespace Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

class Builder implements ContainerAwareInterface
{
    use ContainerAwareTrait;

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $menu = $factory->createItem('root');

        $menu->addChild('Services', array('route' => 'entity_list'));

        $menu->addChild('Add new supplier', array(
            'route' => 'supplier_add',
        ));

        return $menu;
    }
}

Add 'create supplier' page to header menu


<?php

namespace Demo;

/** A sample demo test class using MS SQL
 *
 * Example of how to use the permanent object.
 */
class DemoTest_MSSQL extends DemoTest {

	//Attributes
	protected static $DBInstance = 'mssql';

}

<?php

namespace Demo;

/** A sample demo test class using MS SQL
 *
 * Example of how to use the permanent object.
 */
class DemoTest_MSSQL extends DemoTest {

	//Attributes
	protected static ?string $instanceName = 'mssql';

}

Fix new features for create & update things Can still assign a db instance name to an entity Pig


<?php

namespace Raffle;

class RandomService
{
    /**
     * Base URL
     */
    const BASE_URL = 'http://www.random.org/integers/?min=%d&max=%d&num=%d&col=1&base=10&format=plain&rnd=new';

    /**
     * Retrieve a block of random numbers.
     *
     * @param int $min   Minimum amount.
     * @param int $max   Maximum amount.
     * @param int $count How many numbers.
     * @return array
     */
    public function getRandomNumbers($min, $max, $count)
    {
        // Construct the URL
        $url = sprintf(self::BASE_URL, $min, $max, $count);

        // Fetch the numbers
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);

        // Decode data and return
        return explode("\n", trim($data));
    }
}

<?php

namespace Raffle;

class RandomService
{
    /**
     * Base URL
     */
	const BASE_URL = 'http://www.random.org/integer-sets/?sets=1&min=%d&max=%d&num=%d&order=random&format=plain&rnd=new';

    /**
     * Retrieve a block of random numbers.
     *
     * @param int $min   Minimum amount.
     * @param int $max   Maximum amount.
     * @param int $count How many numbers.
     * @return array
     */
    public function getRandomNumbers($min, $max, $count)
    {
        // Construct the URL
        $url = sprintf(self::BASE_URL, $min, $max, $count);

        // Fetch the numbers
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);

        // Decode data and return
        return explode(" ", trim($data));
    }
}

Switch to a uniquely random set of numbers, so there are no winners drawn twice


<?php

namespace Flint\Provider;

use Symfony\Component\HttpKernel\EventListener\ExceptionListener;
use Flint\Controller\ControllerResolver;
use Silex\Application;

/**
 * @package Flint
 */
class FlintServiceProvider implements \Silex\ServiceProviderInterface
{
    /**
     * {@inheritDoc}
     */
    public function register(Application $app)
    {
        $app['exception_handler'] = $app->share(function ($app) {
            return new ExceptionListener('Flint\\Controller\\ExceptionController::showAction', $app['logger']);
        });

        $app->extend('resolver', function ($resolver, $app) {
            return new ControllerResolver($resolver, $app);
        });

        $app->extend('twig.loader.filesystem', function ($loader, $app) {
            $loader->addPath(__DIR__ . '/../Resources/views', 'Flint');

            return $loader;
        });
    }

    /**
     * {@inheritDoc}
     */
    public function boot(Application $app)
    {
    }
}

<?php

namespace Flint\Provider;

use Symfony\Component\HttpKernel\EventListener\ExceptionListener;
use Flint\Controller\ControllerResolver;
use Silex\Application;

/**
 * @package Flint
 */
class FlintServiceProvider implements \Silex\ServiceProviderInterface
{
    /**
     * {@inheritDoc}
     */
    public function register(Application $app)
    {
        $app['exception_controller'] = 'Flint\\Controller\\ExceptionController::showAction';

        $app['exception_handler'] = $app->share(function ($app) {
            return new ExceptionListener($app['exception_controller'], $app['logger']);
        });

        $app->extend('resolver', function ($resolver, $app) {
            return new ControllerResolver($resolver, $app);
        });

        $app->extend('twig.loader.filesystem', function ($loader, $app) {
            $loader->addPath(__DIR__ . '/../Resources/views', 'Flint');

            return $loader;
        });
    }

    /**
     * {@inheritDoc}
     */
    public function boot(Application $app)
    {
    }
}

Allow to override the controller used for excetion handling