Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Change formatting of help output | <?php
namespace Psocksd\Command;
use Psocksd\App;
class Help implements CommandInterface
{
private $app;
public function __construct(App $app)
{
$this->app = $app;
}
public function run($args)
{
echo 'psocksd help:' . PHP_EOL;
foreach ($this->app->getCommands() as $n... | <?php
namespace Psocksd\Command;
use Psocksd\App;
class Help implements CommandInterface
{
private $app;
public function __construct(App $app)
{
$this->app = $app;
}
public function run($args)
{
echo 'psocksd help:' . PHP_EOL;
$this->dumpCommands($this->app->getComma... |
Add type hints to functions | <?php
namespace UghAuthentication\Authentication;
use Zend\Authentication\Adapter\AdapterInterface;
use Zend\Authentication\AuthenticationServiceInterface;
use Zend\Authentication\Storage\StorageInterface;
class AuthenticationService implements AuthenticationServiceInterface
{
/** @var AdapterInterface */
p... | <?php
namespace UghAuthentication\Authentication;
use Zend\Authentication\Adapter\AdapterInterface;
use Zend\Authentication\AuthenticationServiceInterface;
use Zend\Authentication\Result;
use Zend\Authentication\Storage\StorageInterface;
class AuthenticationService implements AuthenticationServiceInterface
{
/*... |
Add default widget area as recommended in best practices | <?php
/**
* The sidebar containing the main widget area
* Implement your custom sidebar to this file.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package air
*/
?>
<aside id="secondary" class="widget-area">
</aside><!-- #secondary -->
| <?php
/**
* The sidebar containing the main widget area
* Implement your custom sidebar to this file.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package air
*/
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<aside id="secondary" class="widget-area"... |
Fix name of config keys | <?php
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;
use KnpU\OAuth2ClientBundle\Client\Provider\InstagramClient;
use League\OAuth2\Client\Provider\Instagram;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
class InstagramProviderConfigurator implements ProviderConfiguratorInterface
{
... | <?php
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;
use KnpU\OAuth2ClientBundle\Client\Provider\InstagramClient;
use League\OAuth2\Client\Provider\Instagram;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
class InstagramProviderConfigurator implements ProviderConfiguratorInterface
{
... |
Return types in repositories & dataset | <?php
/*
* WellCommerce Open-Source E-Commerce Platform
*
* This file is part of the WellCommerce package.
*
* (c) Adam Piotrowski <adam@wellcommerce.org>
*
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
*/
namespace WellCommerce\Bun... | <?php
/*
* WellCommerce Open-Source E-Commerce Platform
*
* This file is part of the WellCommerce package.
*
* (c) Adam Piotrowski <adam@wellcommerce.org>
*
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
*/
namespace WellCommerce\Bun... |
Extend base listener not implement | <?php
/**
* Humbug
*
* @category Humbug
* @package Humbug
* @copyright Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
* @license https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
*/
namespace Humbug\Phpunit\Listener;
class TimeCollectorListener implements \PHPUnit_... | <?php
/**
* Humbug
*
* @category Humbug
* @package Humbug
* @copyright Copyright (c) 2015 Pádraic Brady (http://blog.astrumfutura.com)
* @license https://github.com/padraic/humbug/blob/master/LICENSE New BSD License
*/
namespace Humbug\Phpunit\Listener;
class TimeCollectorListener extends \PHPUnit_Fra... |
Disable Internet Banking method if Omise extension is either disabled or uninstalled. | <?php
class ModelPaymentOmiseOffsite extends Model {
public function getMethod($address, $total) {
$this->load->language('payment/omise_offsite');
if ($this->config->get('omise_offsite_payment_title') != "")
$payment_title = $this->config->get('omise_offsite_payment_title');
els... | <?php
class ModelPaymentOmiseOffsite extends Model {
public function getMethod($address, $total) {
if ($this->config->get('omise_status') != 1) {
return false;
}
$this->load->language('payment/omise_offsite');
if ($this->config->get('omise_offsite_payment_title') != "")... |
Disable PluginsCategories till it is fixed | <?php
/*
* This file is part of PhuninCake.
*
** (c) 2013 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\PhuninCake\Event;
use Cake\Event\EventListenerInterface;
use WyriHaximus\PhuninNode... | <?php
/*
* This file is part of PhuninCake.
*
** (c) 2013 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\PhuninCake\Event;
use Cake\Event\EventListenerInterface;
use WyriHaximus\PhuninNode... |
Improve code coverage for String | <?php
namespace test\Widmogrod\Primitive;
use Widmogrod\FantasyLand\Monoid;
use Widmogrod\Helpful\MonoidLaws;
use Widmogrod\Primitive\Stringg;
use Widmogrod\Functional as f;
class StringgTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider provideRandomizedData
*/
public function test_it_... | <?php
namespace test\Widmogrod\Primitive;
use Widmogrod\FantasyLand\Monoid;
use Widmogrod\Functional as f;
use Widmogrod\Helpful\MonoidLaws;
use Widmogrod\Primitive\Product;
use Widmogrod\Primitive\Stringg;
class StringgTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider provideRandomizedData
... |
Update to follow DTC website changes | <?php
class DansTonChatBridge extends BridgeAbstract {
const MAINTAINER = 'Astalaseven';
const NAME = 'DansTonChat Bridge';
const URI = 'https://danstonchat.com/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = 'Returns latest quotes from DansTonChat.';
public function collectData(){
$html = getSimple... | <?php
class DansTonChatBridge extends BridgeAbstract {
const MAINTAINER = 'Astalaseven';
const NAME = 'DansTonChat Bridge';
const URI = 'https://danstonchat.com/';
const CACHE_TIMEOUT = 21600; //6h
const DESCRIPTION = 'Returns latest quotes from DansTonChat.';
public function collectData(){
$html = getSimple... |
Add exists() method to active record files | <?php
namespace ATP\ActiveRecord;
class File
{
public $name = "";
public $type = "";
public $size = "";
public function setFrom($data)
{
if(is_null($data)) return;
if(!is_array($data)) $data = get_object_vars(json_decode($data));
$this->name = $data['name'];
$this->type = $data['type'];
$this->s... | <?php
namespace ATP\ActiveRecord;
class File
{
public $name = "";
public $type = "";
public $size = "";
public function setFrom($data)
{
if(is_null($data)) return;
if(!is_array($data)) $data = get_object_vars(json_decode($data));
$this->name = $data['name'];
$this->type = $data['type'];
$this->s... |
Make site optional for RenderEvironment | <?php
class CM_RenderEnvironment extends CM_Class_Abstract {
/** @var CM_Model_User|null */
protected $_viewer;
/** @var CM_Site_Abstract */
protected $_site;
/**
* @param CM_Site_Abstract $site
* @param CM_Model_User|null $viewer
*/
public function __construct(CM_Site_Abstr... | <?php
class CM_RenderEnvironment extends CM_Class_Abstract {
/** @var CM_Model_User|null */
protected $_viewer;
/** @var CM_Site_Abstract */
protected $_site;
/**
* @param CM_Site_Abstract|null $site
* @param CM_Model_User|null $viewer
*/
public function __construct(CM_Site... |
Add set_included function to twig to change the status of a template | <?php
namespace Common\Core\Twig\Extensions;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
final class IncludeOnceExtension extends AbstractExtension
{
/** @var array */
private $includedTemplates = [];
public function getFunctions(): array
{
return [
... | <?php
namespace Common\Core\Twig\Extensions;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
final class IncludeOnceExtension extends AbstractExtension
{
/** @var array */
private $includedTemplates = [];
public function getFunctions(): array
{
return [
... |
Add shortcut function for absolute images. | <?php
namespace AbleCore;
class HTML {
public static function image($source, $alt = '', $title = '', array $attributes = array(), array $options = array())
{
$default_options = array(
'type' => 'theme',
);
$options = array_replace_recursive($default_options, $options);
$variables = array();
switch($o... | <?php
namespace AbleCore;
class HTML {
public static function image($source, $alt = '', $title = '', array $attributes = array(), array $options = array())
{
$default_options = array(
'type' => 'theme',
);
$options = array_replace_recursive($default_options, $options);
$variables = array();
switch($o... |
Add tests for new ID mechanism | <?php
namespace SmoothPhp\Test\CommandBus;
/**
* Class CommandTest
* @author Simon Bennett <simon.bennett@smoothphp.com>
*/
class CommandTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function build_command_test()
{
$command = new TestCommand();
$this->assert... | <?php
namespace SmoothPhp\Test\CommandBus;
/**
* Class CommandTest
* @author Simon Bennett <simon.bennett@smoothphp.com>
*/
class CommandTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function build_command_test()
{
$command = new TestCommand();
$this->assert... |
Use task runner util in console tests | <?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Aedart\Scaffold\Contracts\Tasks\ConsoleTask;
use Mockery as m;
/**
* Console Test
*
* Provides a few helpers for CLI / Console related
* testing
*
* @author Alin Eugen Deac <aedart@gmail.com>
*/
... | <?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Aedart\Scaffold\Contracts\Tasks\ConsoleTask;
use Mockery as m;
/**
* Console Test
*
* Provides a few helpers for CLI / Console related
* testing
*
* @author Alin Eugen Deac <aedart@gmail.com>
*/
... |
Use singleton method for binding shared instance. | <?php namespace Illuminate\Events;
use Illuminate\Support\ServiceProvider;
class EventServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['events'] = $this->app->share(function($app)
{
return new D... | <?php namespace Illuminate\Events;
use Illuminate\Support\ServiceProvider;
class EventServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('events', function($app)
{
return new Dispatcher... |
Unify criteria for split name | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... |
Remove extra blank lines before class closing brace | <?php namespace CL\Atlas;
/**
* @author Ivan Kerin
* @copyright (c) 2014 Clippings Ltd.
* @license http://www.opensource.org/licenses/isc-license.txt
*/
interface Parametrised
{
public function parameters();
}
| <?php namespace CL\Atlas;
/**
* @author Ivan Kerin
* @copyright (c) 2014 Clippings Ltd.
* @license http://www.opensource.org/licenses/isc-license.txt
*/
interface Parametrised
{
public function parameters();
}
|
Add query param support for getAll users request | <?php
namespace RIPS\Connector\Requests;
class UserRequests extends BaseRequest
{
// @var string
protected $uri = '/users';
/**
* Get all users
*
* @return array
*/
public function getAll()
{
$response = $this->client->get($this->uri);
return $this->handleResp... | <?php
namespace RIPS\Connector\Requests;
class UserRequests extends BaseRequest
{
// @var string
protected $uri = '/users';
/**
* Get all users
*
* @param array $queryParams
* @return array
*/
public function getAll(array $queryParams)
{
$response = $this->client-... |
Improve error handling while parsing XML data | <?php
/**
* This code is free software; you can redistribute it and/or modify it under
* the terms of the new BSD License.
*
* Copyright (c) 2009-2011, Sebastian Staudt
*
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
require_once STEAM_CONDENSER_PATH . 'exceptions/SteamCondens... | <?php
/**
* This code is free software; you can redistribute it and/or modify it under
* the terms of the new BSD License.
*
* Copyright (c) 2009-2013, Sebastian Staudt
*
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
require_once STEAM_CONDENSER_PATH . 'exceptions/SteamCondens... |
Update demo to add all possibilities. | <?php
require '../autoloader.php';
$redis = new Yampee_Redis_Client();
$redis->set('key', 'value');
if ($redis->has('key')) {
$redis->get('key');
}
| <?php
require '../autoloader.php';
$redis = new Yampee_Redis_Client();
// Getters/Setters
$redis->set('key', 'value');
if ($redis->has('key')) {
$redis->get('key');
}
$redis->remove('key');
// You can authenticate on the server:
$redis->authenticate('password');
// You can remove an expiration on a value
$redis... |
Fix query to have all tags taken into account on recipe search | <?php
namespace AppBundle\Entity;
/**
* RecipeRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class RecipeRepository extends \Doctrine\ORM\EntityRepository
{
public function searchRecipes($categoryId, $tags)
{
$queryBuilder = $this->... | <?php
namespace AppBundle\Entity;
/**
* RecipeRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class RecipeRepository extends \Doctrine\ORM\EntityRepository
{
public function searchRecipes($categoryId, $tags)
{
$queryBuilder = $this->... |
Fix to return json response to invalid tokens. Fix to exception throws not being catch correctly. | <?php
namespace Cvogit\LumenJWT\Http\Middleware;
use Closure;
use \InvalidArgumentException;
use \RuntimeException;
use Illuminate\Http\Request;
use Cvogit\LumenJWT\JWT;
use Cvogit\LumenJWT\Parser;
class JwtGuard
{
/**
* The parsed jwt
*
*/
protected $jwt;
/**
* The parser
*
*/
protected $parser;
... | <?php
namespace Cvogit\LumenJWT\Http\Middleware;
use Closure;
use \InvalidArgumentException;
use \RuntimeException;
use Illuminate\Http\Request;
use Cvogit\LumenJWT\JWT;
use Cvogit\LumenJWT\Parser;
class JwtGuard
{
/**
* The parsed jwt
*
* @var \Cvogit\LumenJWT\JWT $jwt
*/
protected $jwt;
/**
* The p... |
Use a data-provider for tests. | <?php
namespace Tests;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
class UuidResolversTest extends PHPUnit_Framework_TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Dyrynda\Database\Support\GeneratesUuid
*/
protected $generator;
public function setUp()
{
$t... | <?php
namespace Tests;
use Dyrynda\Database\Support\GeneratesUuid;
use PHPUnit_Framework_TestCase;
class UuidResolversTest extends PHPUnit_Framework_TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Dyrynda\Database\Support\GeneratesUuid
*/
protected $generator;
public function s... |
Add default parameter values to method | <?php
namespace Concrete\Controller;
class Feed extends \Concrete\Core\Controller\Controller
{
public function get($identifier)
{
$feed = \Concrete\Core\Page\Feed::getByHandle($identifier);
if (is_object($feed)) {
//header('Content-Type: text/xml');
$xml = $feed->getOutp... | <?php
namespace Concrete\Controller;
class Feed extends \Concrete\Core\Controller\Controller
{
public function get($identifier=null, $defaultValue=null)
{
$feed = \Concrete\Core\Page\Feed::getByHandle($identifier);
if (is_object($feed)) {
//header('Content-Type: text/xml');
... |
Use bootstrap from environment instead of static instance | <?php
/**
* Definition of class Language
*
* @copyright 2014-today Justso GmbH
* @author j.schirrmacher@justso.de
* @package justso\service
*/
namespace justso\justtexts\service;
use justso\justapi\Bootstrap;
use justso\justapi\RestService;
/**
* Class Language
* @package justso\service
*/
class Lan... | <?php
/**
* Definition of class Language
*
* @copyright 2014-today Justso GmbH
* @author j.schirrmacher@justso.de
* @package justso\service
*/
namespace justso\justtexts\service;
use justso\justapi\RestService;
/**
* Class Language
* @package justso\service
*/
class Language extends RestService
{
... |
Add homepage for plugin details | <?php namespace Nocio\FormStore;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
/**
* Component details
* @return array
*/
public function componentDetails()
{
return [
'name' => 'nocio.formstore::lang.plugin.name',
'description' => ... | <?php namespace Nocio\FormStore;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
/**
* Component details
* @return array
*/
public function componentDetails()
{
return [
'name' => 'nocio.formstore::lang.plugin.name',
'description' => '... |
Fix bug with hash-ref url | <?
include_once("include/passwd.php");
pg_connect($pgconnstr);
Header("Content-Type: text/html; charset=utf-8");
if (!isset($_GET["title"])) {
print "Обязательный параметр title не определён!";
exit;
}
$title = $_GET["title"];
if (isset($_GET["js"]) && $_GET["js"]) $title = urldecode($title);
$title = preg_repla... | <?
include_once("include/passwd.php");
pg_connect($pgconnstr);
Header("Content-Type: text/html; charset=utf-8");
if (!isset($_GET["title"])) {
print "Обязательный параметр title не определён!";
exit;
}
$title = $_GET["title"];
if (isset($_GET["js"]) && $_GET["js"]) $title = urldecode($title);
$title = preg_repla... |
Add test for add single email function | <?php
class AddMailTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setHost('127.0.0.1');
$this->setBrowser('firefox');
$this->setBrowserUrl('http://mail-sender.dev');
}
public function setUpPage()
{
$this->url('/mail_sender.ph... | <?php
class AddMailTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setHost('127.0.0.1');
$this->setBrowser('firefox');
$this->setBrowserUrl('http://mail-sender.dev');
}
public function setUpPage()
{
$this->url('/mail_sender.ph... |
Add a set of prefixes for routes skipping | <?php
return [
'providers' => [
#\App\Http\Terranet\Administrator\Navigation\Providers\PagesProvider::class,
\App\Http\Terranet\Administrator\Navigation\Providers\RoutesProvider::class,
\App\Http\Terranet\Administrator\Navigation\Providers\LinksProvider::class,
],
'paths' => [
... | <?php
return [
'providers' => [
#\App\Http\Terranet\Administrator\Navigation\Providers\PagesProvider::class,
\App\Http\Terranet\Administrator\Navigation\Providers\RoutesProvider::class,
\App\Http\Terranet\Administrator\Navigation\Providers\LinksProvider::class,
],
'paths' => [
... |
Fix typo in mapping array key. | <?php
namespace Borfast\Socializr;
class Profile
{
public $provider;
public $id;
public $email;
public $name;
public $first_name;
public $middle_name;
public $last_name;
public $username;
public $link;
public $raw_response;
public $avatar;
/**
* Create a new Prof... | <?php
namespace Borfast\Socializr;
class Profile
{
public $provider;
public $id;
public $email;
public $name;
public $first_name;
public $middle_name;
public $last_name;
public $username;
public $link;
public $raw_response;
public $avatar;
/**
* Create a new Prof... |
Correct class name in comment | <?php
namespace CultuurNet\UDB3\Event\Events;
use CultuurNet\UDB3\Event\EventEvent;
use CultuurNet\UDB3\Offer\ImageRemoveTrait;
/**
* Provides an ImageDeleted event.
*/
class ImageRemoved extends EventEvent
{
use ImageRemoveTrait;
}
| <?php
namespace CultuurNet\UDB3\Event\Events;
use CultuurNet\UDB3\Event\EventEvent;
use CultuurNet\UDB3\Offer\ImageRemoveTrait;
/**
* Provides an ImageRemoved event.
*/
class ImageRemoved extends EventEvent
{
use ImageRemoveTrait;
}
|
Add an example on how to specify default parameters | <?php
return [
// Source filesystem
'source' => new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Local(storage_path('files'))),
// Cache filesystem
'cache' => new League\Flysystem\Filesystem(new League\Flysystem\Memory\MemoryAdapter()),
// Image driver (gd or imagick)
'driver' ... | <?php
return [
// Source filesystem
'source' => new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Local(storage_path('files'))),
// Cache filesystem
'cache' => new League\Flysystem\Filesystem(new League\Flysystem\Memory\MemoryAdapter()),
// Image driver (gd or imagick)
... |
Create new database column to store avatar location. | <?php
use yii\db\Schema;
use yii\db\Migration;
class m150720_012512_create_table_account extends Migration
{
public function up()
{
$this->createTable('account', [
'id' => Schema::TYPE_PK,
'user_id' => Schema::integer(),
'bio' => Schema::text() . ' NOT NULL',
... | <?php
use yii\db\Schema;
use yii\db\Migration;
class m150720_012512_create_table_account extends Migration
{
public function up()
{
$this->createTable('account', [
'id' => Schema::TYPE_PK,
'user_id' => Schema::integer(),
'bio' => Schema::text() . ' NOT NULL',
... |
FIX Assert elemental areas exist before calling methods on them | <?php
namespace DNADesign\Elemental\GraphQL;
use DNADesign\Elemental\Models\ElementalArea;
use GraphQL\Type\Definition\ResolveInfo;
use SilverStripe\GraphQL\OperationResolver;
class ReadOneAreaResolver implements OperationResolver
{
public function resolve($object, array $args, $context, ResolveInfo $info)
{... | <?php
namespace DNADesign\Elemental\GraphQL;
use DNADesign\Elemental\Models\ElementalArea;
use Exception;
use GraphQL\Type\Definition\ResolveInfo;
use InvalidArgumentException;
use SilverStripe\GraphQL\OperationResolver;
class ReadOneAreaResolver implements OperationResolver
{
public function resolve($object, ar... |
Remove the extra setNotModified function call. | <?php namespace Aranw\ETagsMiddleware;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
class ETags implements HttpKernelInterface {
/**
* The wrapped kernel implementation.
*
* @var \Symfony\Component\HttpKernel\HttpKernelInterf... | <?php namespace Aranw\ETagsMiddleware;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
class ETags implements HttpKernelInterface {
/**
* The wrapped kernel implementation.
*
* @var \Symfony\Component\HttpKernel\HttpKernelInterf... |
Change populate method to allow limit to be null and take an extra array of filters. | <?php
namespace Plummer\Calendarful\Calendar;
use Plummer\Calendarful\RegistryInterface;
interface CalendarInterface
{
public function populate(RegistryInterface $eventsRegistry, \DateTime $fromDate, \DateTime $toDate, $limit);
public function sort();
}
| <?php
namespace Plummer\Calendarful\Calendar;
use Plummer\Calendarful\RegistryInterface;
interface CalendarInterface
{
public function populate(RegistryInterface $eventsRegistry, \DateTime $fromDate, \DateTime $toDate, $limit = null, Array $extraFilters = array());
public function sort();
}
|
Add Pdo db config tests | <?php
namespace ACache\Tests;
use PDO;
use ACache\PdoCache;
/**
* PdoCache tests.
*/
class PdoCacheTest extends NamespaceCacheTest
{
/**
* Cache provider.
*/
public function cacheProvider()
{
$pdo = new PDO('sqlite::memory:');
// create cache table using naming defaults
... | <?php
namespace ACache\Tests;
use PDO;
use ACache\PdoCache;
/**
* PdoCache tests.
*/
class PdoCacheTest extends NamespaceCacheTest
{
/**
* Cache provider.
*/
public function cacheProvider()
{
$pdoDefaults = new PDO('sqlite::memory:');
// create cache table using naming default... |
Revert "Simplify queue draining code" | <?php
namespace React\Promise;
class CancellationQueue
{
private $started = false;
/**
* @var CancellablePromiseInterface[]
*/
private $queue = [];
public function __invoke()
{
if ($this->started) {
return;
}
$this->started = true;
$this->dr... | <?php
namespace React\Promise;
class CancellationQueue
{
private $started = false;
/**
* @var CancellablePromiseInterface[]
*/
private $queue = [];
public function __invoke()
{
if ($this->started) {
return;
}
$this->started = true;
$this->dr... |
Switch license from MIT to AGPL in plugin file | <?php
/*
Plugin Name: Castlegate IT WP Conditional Downloads
Plugin URI: https://github.com/castlegateit/cgit-wp-conditional-downloads
Description: Add conditions to protect file downloads
Version: 1.0.4
Author: Castlegate IT
Author URI: https://www.castlegateit.co.uk/
License: MIT
*/
if (!defined('ABSPATH')) {
... | <?php
/*
Plugin Name: Castlegate IT WP Conditional Downloads
Plugin URI: https://github.com/castlegateit/cgit-wp-conditional-downloads
Description: Add conditions to protect file downloads
Version: 1.0.4
Author: Castlegate IT
Author URI: https://www.castlegateit.co.uk/
License: AGPL
*/
if (!defined('ABSPATH')) {
... |
Add user activated Nova filter name | <?php
namespace OpenDominion\Nova\Filters;
use Illuminate\Http\Request;
use Laravel\Nova\Filters\Filter;
class UserActivated extends Filter
{
/**
* Apply the filter to the given query.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Database\Eloquent\Builder $query
... | <?php
namespace OpenDominion\Nova\Filters;
use Illuminate\Http\Request;
use Laravel\Nova\Filters\Filter;
class UserActivated extends Filter
{
/**
* The displayable name of the action.
*
* @var string
*/
public $name = 'Activated';
/**
* Apply the filter to the given query.
... |
Add in slick new address functions | <?php
/* ------------------------------------------------------------------------ *\
* Custom Functions
\* ------------------------------------------------------------------------ */
// get a nicer excerpt based on post ID
function get_better_excerpt($id = 0, $length = 55, $more = " [...]") {
global $post;
$... | <?php
/* ------------------------------------------------------------------------ *\
* Custom Functions
\* ------------------------------------------------------------------------ */
// get a nicer excerpt based on post ID
function get_better_excerpt($id = 0, $length = 55, $more = " [...]") {
global $post;
$... |
Add comment clarifying helper exception rationale | <?php
namespace Rogue\Services;
use Softonic\GraphQL\ClientBuilder;
class GraphQL
{
/**
* Build a new GraphQL client.
*/
public function __construct()
{
$this->client = ClientBuilder::build(config('services.graphql.url'));
}
/**
* Run a GraphQL query using the client and r... | <?php
namespace Rogue\Services;
use Softonic\GraphQL\ClientBuilder;
class GraphQL
{
/**
* Build a new GraphQL client.
*/
public function __construct()
{
$this->client = ClientBuilder::build(config('services.graphql.url'));
}
/**
* Run a GraphQL query using the client and r... |
Remove unused variable and comments | <?php
namespace Becklyn\RadBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony... | <?php
namespace Becklyn\RadBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony... |
Remove unused option, fix CS | <?php
namespace Gloubster;
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Connection\AMQPSSLConnection;
class RabbitMQFactory
{
public static function createConnection(Configuration $conf, $connected = true)
{
if (isset($conf['server']['ssl']) && $conf['server']['ssl']['enable']) {
... | <?php
namespace Gloubster;
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Connection\AMQPSSLConnection;
class RabbitMQFactory
{
public static function createConnection(Configuration $conf)
{
if (isset($conf['server']['ssl']) && $conf['server']['ssl']['enable']) {
$connection = ... |
Improve read performance of PHP. | <?php
class Base {
public $dbh;
public function __construct() {
$this->dbh = new PDO("mysql:host=localhost;dbname=test","test","test",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
public function processPageSQL($params, $searchSQL) {
$page = $params["page"] - 1;
$pageNumber = $params["... | <?php
class Base {
public $dbh;
public function __construct() {
$this->dbh = new PDO("mysql:host=localhost;dbname=test","test","test",array(PDO::ATTR_PERSISTENT => TRUE, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
public function processPageSQL($params, $searchSQL) {
$page = $params["page"] ... |
Fix minor errors found with debug mode on | <?php
/**
* Planet item
*/
class PlanetItem
{
public function __construct($feed, $data)
{
parent::SimplePie_Item($feed, $data);
}
public function compare($item1, $item2)
{
$item1_date = $item1->get_date('U');
$item2_date = $item2->get_date('U');
if ($item1_date ... | <?php
/**
* Planet item
*/
class PlanetItem extends SimplePie_Item
{
public function __construct($feed, $data)
{
parent::__construct($feed, $data);
}
/**
* @param PlanetItem $item1
* @param PlanetItem $item2
* @return int
*/
public static function compare($item1, $it... |
Create a plan if it doesn't exist and subscribe the customer to it, or do a one-time transaction | <?php
require_once('./config.php');
var_dump($_POST);
$token = $_POST['stripeToken'];
$email = $_POST['stripeEmail'];
$amount = $_POST['amount'];
$recurring = $_POST['recurring'];
$customer = Stripe_Customer::create(array(
'email' => $email,
'card' => $token
));
if ( !empty($r... | <?php
require_once('./config.php');
var_dump($_POST);
$token = $_POST['stripeToken'];
$email = $_POST['stripeEmail'];
$amount = $_POST['amount'];
$recurring = $_POST['recurring'];
// validate the amount
if ( !empty($recurring) ) {
try {
$plan = Stripe_Plan::retrieve("monthly{$am... |
Fix Travis tests not failing with AUTOLOAD=0 | #!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
$autoload = (int)$argv[1];
$returnStatus = null;
$composerOriginalRaw = file_get_contents('composer.json');
if (!$autoload) {
// Modify composer to not autoload WonderPush
$composer = json_decode($composerOriginalRaw, true);
unset($composer['autoload']);
file... | #!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
$autoload = (int)$argv[1];
$returnStatus = null;
$composerOriginalRaw = file_get_contents('composer.json');
if (!$autoload) {
// Modify composer to not autoload WonderPush
$composer = json_decode($composerOriginalRaw, true);
unset($composer['autoload']);
file... |
Define our constants FIRST to prevent errors | <?php
// Start the session so we can save
// query results across pages requests.
session_start();
ini_set('display_errors', 1);
error_reporting(E_ALL & E_NOTICE);
require 'vendor/autoload.php';
require 'APICaller.php';
include 'config.php';
define("APPNAME", "CNAM");
define("VERSION", "1.3");
define("APIVersion",... | <?php
// Start the session so we can save
// query results across pages requests.
session_start();
ini_set('display_errors', 0);
error_reporting(E_ALL & ~E_NOTICE);
define("APPNAME", "CNAM");
define("VERSION", "1.3");
define("APIVersion", "1");
define("DEVGITHUB", "https://www.github.com/cedwardsmedia/cnam");
define... |
Use phpcs as a library. | #!/usr/bin/env php
<?php
chdir(__DIR__);
$returnStatus = null;
passthru('composer install --dev', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
require 'vendor/autoload.php';
passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/vendor/dominionenterprises/dws-coding-standard/DWS -n src tests *.php', $r... | #!/usr/bin/env php
<?php
chdir(__DIR__);
$returnStatus = null;
passthru('composer install --dev', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
require 'vendor/autoload.php';
$phpcsCLI = new PHP_CodeSniffer_CLI();
$phpcsArguments = array(
'standard' => array(__DIR__ . '/vendor/dominionenterprises/dws... |
Enable auto creating translation category | <?php
namespace papalapa\yiistart\models;
use papalapa\yiistart\modules\i18n\models\SourceMessage;
use papalapa\yiistart\modules\i18n\models\SourceMessageCategories;
use yii\i18n\MissingTranslationEvent;
/**
* Class TranslationEventHandler
* @package papalapa\yiistart\models
*/
... | <?php
namespace papalapa\yiistart\models;
use papalapa\yiistart\modules\i18n\models\SourceMessage;
use papalapa\yiistart\modules\i18n\models\SourceMessageCategories;
use yii\i18n\MissingTranslationEvent;
/**
* Class TranslationEventHandler
* @package papalapa\yiistart\models
*/
... |
Add read only functionnality on published node | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... |
Add comment with the value of the hashed password | <?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories pro... | <?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories pro... |
Add Solr enable/disable commands tests | <?php
namespace Pantheon\Terminus\Tests\Functional;
use Pantheon\Terminus\Tests\Traits\LoginHelperTrait;
use Pantheon\Terminus\Tests\Traits\SiteBaseSetupTrait;
use Pantheon\Terminus\Tests\Traits\TerminusTestTrait;
use Pantheon\Terminus\Tests\Traits\UrlStatusCodeHelperTrait;
use PHPUnit\Framework\TestCase;
/**
* Cla... | <?php
namespace Pantheon\Terminus\Tests\Functional;
use Pantheon\Terminus\Tests\Traits\LoginHelperTrait;
use Pantheon\Terminus\Tests\Traits\TerminusTestTrait;
use PHPUnit\Framework\TestCase;
/**
* Class SolrCommandsTest
*
* @package Pantheon\Terminus\Tests\Functional
*/
class SolrCommandsTest extends TestCase
{
... |
Remove @package & restart travis | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Z... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... |
Use table helper for output | <?php
/**
* @file
* Contains \Drupal\AppConsole\Command\ConfigDebugCommand.
*/
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ConfigDebugCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
pr... | <?php
/**
* @file
* Contains \Drupal\AppConsole\Command\ConfigDebugCommand.
*/
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ConfigDebugCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
pr... |
Rename and reorder CreateIndexes tests | <?php
namespace MongoDB\Tests\Operation;
use MongoDB\Operation\CreateIndexes;
class CreateIndexesTest extends TestCase
{
/**
* @expectedException MongoDB\Exception\InvalidArgumentException
* @expectedExceptionMessage $indexes is empty
*/
public function testCreateIndexesRequiresAtLeastOneIndex... | <?php
namespace MongoDB\Tests\Operation;
use MongoDB\Operation\CreateIndexes;
class CreateIndexesTest extends TestCase
{
/**
* @expectedException MongoDB\Exception\InvalidArgumentException
* @expectedExceptionMessage $indexes is not a list (unexpected index: "1")
*/
public function testConstru... |
Tweak the filters and some UI of the product catalog | <?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\Product\Repository;
use Sylius\Component\Resource\Repository\RepositoryInt... | <?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\Product\Repository;
use Sylius\Component\Resource\Repository\RepositoryInt... |
Save option added to form builder | <?php
namespace AppBundle\Form\Type;
/**
* Created by PhpStorm.
* User: kolbusz
* Date: 08.03.15
* Time: 14:16
*/
use \Symfony\Component\Form\AbstractType;
use \Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class TaskType extends AbstractType{
pr... | <?php
namespace AppBundle\Form\Type;
/**
* Created by PhpStorm.
* User: kolbusz
* Date: 08.03.15
* Time: 14:16
*/
use \Symfony\Component\Form\AbstractType;
use \Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class TaskType extends AbstractType{
pr... |
Fix product re-crawl to use correct method from interface | <?php
/**
* Handles product re-crawl requests to Nosto via the API.
*/
class NostoProductReCrawl
{
/**
* Sends a product re-crawl request to nosto.
*
* @param NostoProductInterface $product the product to re-crawl.
* @param NostoAccountInterface $account the account to re-crawl the product for.
* @return ... | <?php
/**
* Handles product re-crawl requests to Nosto via the API.
*/
class NostoProductReCrawl
{
/**
* Sends a product re-crawl request to nosto.
*
* @param NostoProductInterface $product the product to re-crawl.
* @param NostoAccountInterface $account the account to re-crawl the product for.
* @return ... |
Add tests for closing connections | <?php
namespace Forestry\Orm;
class StorageTest extends \PHPUnit_Framework_TestCase {
/**
* Create basic SQLite connection.
*/
public function testSetSQLiteConnection() {
$result = Storage::set('default', ['dsn' => 'sqlite::memory:', '']);
$this->assertInstanceof('PDO', $result);
... | <?php
namespace Forestry\Orm;
class StorageTest extends \PHPUnit_Framework_TestCase {
/**
* Create basic SQLite connection.
*/
public function testSetSQLiteConnection() {
$result = Storage::set('default', ['dsn' => 'sqlite::memory:', '']);
$this->assertInstanceof('PDO', $result);
... |
Replace static with dynamic content | <?php
/**
* The footer for our theme.
*
* Displays all of the footer section following the page content and sidebar
*
* @package Simple Blog Theme
*/
?></div>
<!-- /.row -->
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Your Website 2014</p>
</div>
... | <?php
/**
* The footer for our theme.
*
* Displays all of the footer section following the page content and sidebar
*
* @package Simple Blog Theme
*/
?></div>
<!-- /.row -->
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © <?php bloginfo( 'name' ); ?> <?php... |
Add questions methods in category interface | <?php
namespace Qcm\Component\Category\Model;
/**
* Interface CategoryInterface
*/
interface CategoryInterface
{
/**
* Get id
*
* @return int
*/
public function getId();
/**
* Set name of category
*
* @param string $name
*
* @return $this
*/
public ... | <?php
namespace Qcm\Component\Category\Model;
use Doctrine\Common\Collections\Collection;
use Qcm\Component\Question\Model\QuestionInterface;
/**
* Interface CategoryInterface
*/
interface CategoryInterface
{
/**
* Get id
*
* @return int
*/
public function getId();
/**
* Set na... |
Change 'resolver' argument to 'resolve' | <?php
namespace GraphQLGen\Generator\FragmentGenerators;
use GraphQLGen\Generator\Formatters\StubFormatter;
use GraphQLGen\Generator\InterpretedTypes\Nested\TypeUsageInterpretedType;
trait ResolveFragmentTrait {
/**
* @param StubFormatter $formatter
* @param TypeUsageInterpretedType $fieldType
* @param stri... | <?php
namespace GraphQLGen\Generator\FragmentGenerators;
use GraphQLGen\Generator\Formatters\StubFormatter;
use GraphQLGen\Generator\InterpretedTypes\Nested\TypeUsageInterpretedType;
trait ResolveFragmentTrait {
/**
* @param StubFormatter $formatter
* @param TypeUsageInterpretedType $fieldType
* @param stri... |
Fix middleware if cookie does not exist. | <?php namespace Flarum\Forum\Middleware;
use Flarum\Support\Actor;
use Flarum\Core\Models\AccessToken;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;
class LoginWithCookie implements MiddlewareInterface
{
/**
... | <?php namespace Flarum\Forum\Middleware;
use Flarum\Support\Actor;
use Flarum\Core\Models\AccessToken;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;
class LoginWithCookie implements MiddlewareInterface
{
/**
... |
Add check for current locale | <?php namespace Modules\Blog\Tests;
class EloquentTagRepositoryTest extends BaseBlogTestCase
{
/** @test */
public function it_finds_a_tag_by_name()
{
// Prepare
$this->createTag();
$this->createTag();
$tag = $this->createTag();
// Run
$foundTag = $this->tag... | <?php namespace Modules\Blog\Tests;
use Illuminate\Support\Facades\App;
class EloquentTagRepositoryTest extends BaseBlogTestCase
{
/** @test */
public function it_finds_a_tag_by_name()
{
// Prepare
$this->createTag();
$this->createTag();
$tag = $this->createTag();
... |
Exclude list of taxa as suggested by SPG. | <?php
/* connector for SPIRE
estimated execution time: 10 mins
Connector accesses the OWL (XML) files from remote server for most of the data and uses a spreadsheet for taxonomy info.
*/
include_once(dirname(__FILE__) . "/../../config/environment.php");
require_library('connectors/SpireAPI');
$GLOBALS['ENV_DEBUG'] = ... | <?php
/* connector for SPIRE
estimated execution time: 10 mins
Connector accesses the OWL (XML) files from remote server for most of the data and uses a spreadsheet for taxonomy info.
*/
include_once(dirname(__FILE__) . "/../../config/environment.php");
require_library('connectors/SpireAPI');
$GLOBALS['ENV_DEBUG'] = f... |
Implement basic stats for the dashboard | <?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\Order\Repository;
use Sylius\Component\Order\Model\OrderInterface;
use Syl... | <?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\Order\Repository;
use Sylius\Component\Order\Model\OrderInterface;
use Syl... |
Fix syntax error from wrong quotation mark. | <?php
function env_is_cli() {
return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
}
// ----- only run from command line -----
if (!env_is_cli())
die;
// ----- params -----
set_time_limit(0);
error_reporting(E_ALL);
define('CAP... | <?php
function env_is_cli() {
return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
}
// ----- only run from command line -----
if (!env_is_cli())
die;
// ----- params -----
set_time_limit(0);
error_reporting(E_ALL);
define('CAP... |
Fix SMART stats report title | <?php
return array(
'client_tabs' => array(
'smart_stats-tab' => array('view' => 'smart_stats_tab', 'i18n' => 'smart_stats.clienttabtitle', 'badge' => 'smart_stats-cnt'),
),
'listings' => array(
'smart_stats' => array('view' => 'smart_stats_listing', 'i18n' => 'smart_stats.clienttabtitle'),... | <?php
return array(
'client_tabs' => array(
'smart_stats-tab' => array('view' => 'smart_stats_tab', 'i18n' => 'smart_stats.clienttabtitle', 'badge' => 'smart_stats-cnt'),
),
'listings' => array(
'smart_stats' => array('view' => 'smart_stats_listing', 'i18n' => 'smart_stats.clienttabtitle'),... |
Add properties to image translation entity. | <?php declare(strict_types=1);
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2019, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace... | <?php declare(strict_types=1);
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2019, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace... |
Add author to phpdoc comment | <?php
/**
* Factory functions loader
*
* @author Petr Pliska
*/
foreach (glob(__DIR__ . '/Factory/*.php') as $file) {
require_once $file;
}
| <?php
/**
* @author Petr Pliska <petr.pliska@post.cz>
*/
/**
* Factory functions loader
*
* @author Petr Pliska
*/
foreach (glob(__DIR__ . '/Factory/*.php') as $file) {
require_once $file;
}
|
Fix tree search query nodes table not being added in update. | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Concrete\Core\Block\BlockType\BlockType;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version20161208000000 extends AbstractMigration
{
protected function output($message)
{
$this->version->getC... | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Concrete\Core\Block\BlockType\BlockType;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version20161208000000 extends AbstractMigration
{
protected function output($message)
{
$this->version->getC... |
Fix the home button link. | <script src="js/updater.js"></script>
<?php
include_once 'core.php';
include_once 'db.php';
?>
<a href="../"><img class="logo" style="margin-top:5px;" src="files/logo.png" alt="Hallo"/></a>
<?php
if (isset($_GET['p'])) {
echo '<ul class="navbar-p">';
} else {
echo '<ul class="navbar">';
}
?>
<li><form method... | <script src="js/updater.js"></script>
<?php
include_once 'core.php';
include_once 'db.php';
?>
<a href="../"><img class="logo" style="margin-top:5px;" src="files/logo.png" alt="Hallo"/></a>
<?php
if (isset($_GET['p'])) {
echo '<ul class="navbar-p">';
} else {
echo '<ul class="navbar">';
}
?>
<li><form method... |
Make abstract test case class abstract | <?php
/*
* This file is part of Laravel Pusher.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Vinkla\Tests\Pusher;
use GrahamCampbell\TestBench\AbstractPackageTestCase;
/**... | <?php
/*
* This file is part of Laravel Pusher.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Vinkla\Tests\Pusher;
use GrahamCampbell\TestBench\AbstractPackageTestCase;
/**... |
Allow to include add button | <?php
$title = Orchestra\Site::get('title');
$description = Orchestra\Site::get('description'); ?>
<div class="page-header">
<h2>{{ $title ?: 'Something Awesome' }}
@if ( ! empty($description))
<small>{{ $description ?: '' }}</small>
@endif
</h2>
</div> | <?php
$title = Orchestra\Site::get('title');
$description = Orchestra\Site::get('description'); ?>
<div class="page-header">
@if (Orchestra\Site::get('header::add-button'))
<div class="pull-right">
<a href="{{ URL::current() }}/view" class="btn btn-primary">Add</a>
</div>
@endif
<h2>{{ $title ?: 'Somet... |
Add a message if no options are provided to update | <?php
namespace Lstr\DnsmasqMgmt\Command;
use Exception;
use Lstr\Silex\App\AppAwareInterface;
use Lstr\Silex\App\AppAwareTrait;
use Silex\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Com... | <?php
namespace Lstr\DnsmasqMgmt\Command;
use Exception;
use Lstr\Silex\App\AppAwareInterface;
use Lstr\Silex\App\AppAwareTrait;
use Silex\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Com... |
Create sections for htmlhead and scripts | <!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">
@include('layouts.partials.htmlheader')
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following clas... | <!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">
@section('htmlheader')
@include('layouts.partials.htmlheader')
@show
<!--
BODY TAG OPTIONS:
=================
Apply ... |
Make travis run all migrations before running tests | <?php
function migrate( $sql_array = [] ) {
require_once '../../config/config-local.php';
require_once '../../models/database.php';
require_once '../../models/db.php';
global $config;
$config = getConfig()[ getEnv( 'ENVIRONMENT' ) ];
dbInit();
foreach ( $sq... | <?php
function migrate( $sql_array = [] ) {
if ( file_exists( '../../config/config-local.php' ) ) {
require_once '../../config/config-local.php';
}
else {
require_once '../../config/config.php';
}
require_once '../../models/database.php';
requi... |
Add test to check dummy url mime type | <?php
namespace AssetManager\Service;
use PHPUnit_Framework_TestCase;
class MimeResolverTest extends PHPUnit_Framework_TestCase
{
public function testGetMimeType()
{
//Fails
$mimeResolver = new MimeResolver;
$this->assertEquals('text/plain', $mimeResolver->getMimeType('bacon.porn'));
... | <?php
namespace AssetManager\Service;
use PHPUnit_Framework_TestCase;
class MimeResolverTest extends PHPUnit_Framework_TestCase
{
public function testGetMimeType()
{
//Fails
$mimeResolver = new MimeResolver;
$this->assertEquals('text/plain', $mimeResolver->getMimeType('bacon.porn'));
... |
Remove ajax post from group edit | @extends('maintenance::layouts.admin')
@section('title', 'Edit Group')
@section('content')
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Edit Group {{ $group->name }}</h3>
</div>
<div cla... | @extends('maintenance::layouts.admin')
@section('title', 'Edit Group')
@section('content')
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Edit Group {{ $group->name }}</h3>
</div>
<div cla... |
Add a skeleton class for Uri. | <?PHP
namespace \SerendipityHQ\Framework\ValueObjects\ValueObject;
use \Zend\Uri\Uri as BaseUri;
class Uri extends BaseUri
{}
| <?PHP
namespace \SerendipityHQ\Framework\ValueObjects\ValueObject;
use \Zend\Uri\Uri as BaseUri;
class URI extends BaseUri
{}
|
Remove hello warlus, add skeleton call | <?php
namespace engine\controllers;
use Walrus\core\WalrusFrontController as WalrusFrontController;
/**
* Class HelloController
* @package engine\controllers
*/
class HelloController extends WalrusFrontController
{
public function run()
{
echo 'Hello Walrus!';
}
}
| <?php
namespace engine\controllers;
use Walrus\core\WalrusFrontController as WalrusFrontController;
/**
* Class HelloController
* @package engine\controllers
*/
class HelloController extends WalrusFrontController
{
public function run()
{
$this->skeleton('_skeleton_main');
}
... |
Include debugging on test REST API | <?php
require_once('phpunit-config.php');
// Get MarkLogic version for skipping tests
$serverConfig = $mlphp->getServerConfig();
$mlphp->config['mlversion'] = $serverConfig['version'];
// Create REST API for tests
$api = $mlphp->getAPI()->create();//->setProperty('debug', 'true');
function phpunitTeardown($api)
{
... | <?php
require_once('phpunit-config.php');
// Get MarkLogic version for skipping tests
$serverConfig = $mlphp->getServerConfig();
$mlphp->config['mlversion'] = $serverConfig['version'];
// Create REST API for tests
$api = $mlphp->getAPI()->create()->setProperty('debug', 'true');
function phpunitTeardown($api)
{
... |
Change time and distance getter return types to be nullable | <?php
class ViewData
{
/**
* @var int $time
*/
private $time;
/**
* @var float $distance
*/
private $distance;
const SPEED_PRECISION = 2;
public function __construct()
{
$this->time = $_POST['time'];
$this->distance = $_POST['distance'];
}
/**... | <?php
class ViewData
{
/**
* @var int $time
*/
private $time;
/**
* @var float $distance
*/
private $distance;
const SPEED_PRECISION = 2;
public function __construct()
{
$this->time = $_POST['time'];
$this->distance = $_POST['distance'];
}
/**... |
Set root name in constructor of TreeBuilder | <?php
namespace Spraed\PDFGeneratorBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http:/... | <?php
namespace Spraed\PDFGeneratorBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http:/... |
Remove any empty nodes before combining into a path | <?php
namespace Concrete\Core\Url\Components;
/**
* c5 specific path component for league/url
*/
class Path extends \League\Url\Components\Path
{
protected $trail = false;
/**
* @param \League\Url\Components\Path $old_path
* @param bool $trailing_slash
*/
public fu... | <?php
namespace Concrete\Core\Url\Components;
/**
* c5 specific path component for league/url
*/
class Path extends \League\Url\Components\Path
{
protected $trail = false;
/**
* @param \League\Url\Components\Path $old_path
* @param bool $trailing_slash
*/
public fu... |
Add getTemporaryFile method to base test class | <?php
declare(strict_types=1);
namespace PhpSchool\PhpWorkshopTest;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Filesystem;
abstract class BaseTest extends TestCase
{
private $tempDirectory;
public function getTemporaryDirectory(): string
{
if (!$this->tempDirectory) {
... | <?php
declare(strict_types=1);
namespace PhpSchool\PhpWorkshopTest;
use PhpSchool\PhpWorkshop\Utils\Path;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Filesystem;
abstract class BaseTest extends TestCase
{
private $tempDirectory;
public function getTemporaryDirectory(): string
{
... |
Remove call to unused global function. | @extends('layout.master')
@section('main_content')
@include('layout.header', ['header' => 'Users', 'subtitle' => 'View & edit member profiles.'])
<div class="container -padded">
<div class="wrapper">
<div class="container__block">
<h1>All Users</h1>
<p>We currently have <strong>{{ number_... | @extends('layout.master')
@section('main_content')
@include('layout.header', ['header' => 'Users', 'subtitle' => 'View & edit member profiles.'])
<div class="container -padded">
<div class="wrapper">
<div class="container__block">
<h1>All Users</h1>
<p>We currently have <strong>{{ number_... |
Fix logable listener to remove change_ when needed | <?php
namespace NyroDev\UtilityBundle\Listener;
use Gedmo\Loggable\LoggableListener as SrcLoggableListener;
class LoggableListener extends SrcLoggableListener
{
protected function prePersistLogEntry($logEntry, $object)
{
if (method_exists($object, 'getTranslatableLocale') && method_exists($logEntry, ... | <?php
namespace NyroDev\UtilityBundle\Listener;
use Gedmo\Loggable\LoggableListener as SrcLoggableListener;
class LoggableListener extends SrcLoggableListener
{
protected function prePersistLogEntry($logEntry, $object)
{
if (method_exists($object, 'getTranslatableLocale') && method_exists($logEntry, ... |
Test query is actually created. | <?php
namespace Gt\Database\Query;
class QueryFactoryTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider \Gt\Database\Test\Helper::queryPathExistsProvider
*/
public function testFindQueryFilePathExists(
string $queryName, string $directoryOfQueries) {
$queryFactory = new QueryFactory($directoryOfQueries... | <?php
namespace Gt\Database\Query;
class QueryFactoryTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider \Gt\Database\Test\Helper::queryPathExistsProvider
*/
public function testFindQueryFilePathExists(
string $queryName, string $directoryOfQueries) {
$queryFactory = new QueryFactory($directoryOfQueries... |
Replace leftover app()->url() with UrlGenerator | <?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Akismet\Listener;
use Flarum\Approval\Event\PostWasApproved;
use Flarum\Extend;
use Flarum\Post\Event\Hidden;
use Flarum\Post\Event\... | <?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Akismet\Listener;
use Flarum\Approval\Event\PostWasApproved;
use Flarum\Extend;
use Flarum\Http\UrlGenerator;
use Flarum\Post\Event\... |
Read the docs, setTo takes an array of addresses, which is the right way to do it, not implode it with commas. | <?php
namespace BisonLab\SakonninBundle\Lib\Sakonnin;
/*
*/
class MailForward
{
protected $container;
protected $router;
public function __construct($container, $options = array())
{
$this->container = $container;
}
/* You may call this lazyness, jkust having an options array, but... | <?php
namespace BisonLab\SakonninBundle\Lib\Sakonnin;
/*
*/
class MailForward
{
protected $container;
protected $router;
public function __construct($container, $options = array())
{
$this->container = $container;
}
/* You may call this lazyness, jkust having an options array, but... |
Fix output of remote collection items that lack YAML variables | <?php namespace TightenCo\Jigsaw\Collection;
use Symfony\Component\Yaml\Yaml;
use TightenCo\Jigsaw\Parsers\FrontMatterParser;
class CollectionRemoteItem
{
private $item;
private $index;
private $prefix;
public function __construct($item, $index, $collectionName = null)
{
$this->item = $it... | <?php namespace TightenCo\Jigsaw\Collection;
use Symfony\Component\Yaml\Yaml;
use TightenCo\Jigsaw\Parsers\FrontMatterParser;
class CollectionRemoteItem
{
private $item;
private $index;
private $prefix;
public function __construct($item, $index, $collectionName = null)
{
$this->item = $it... |
Fix user scope working when impersonating other users | <?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
class UserScope implements Scope
{
/**
* Apply the scope to a given Eloquent query builder.
*
* @param \Illuminate\Database\Eloquent\Builder $buil... | <?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
class UserScope implements Scope
{
/**
* Apply the scope to a given Eloquent query builder.
*
* @param \Illuminate\Database\Eloquent\Builder $buil... |
Fix unexpected swoole sever crash on high concurrency operation | <?php
$count = 0;
$pool = new SplQueue();
$server = new Swoole\Http\Server('127.0.0.1', 9501, SWOOLE_BASE);
$server->on('Request', function($request, $response) use(&$count, $pool) {
if (count($pool) == 0) {
$redis = new Swoole\Coroutine\Redis();
$res = $redis->connect('127.0.0.1', 6379);
i... | <?php
$count = 0;
$pool = new SplQueue();
$server = new Swoole\Http\Server('127.0.0.1', 9501, SWOOLE_BASE);
$server->on('Request', function($request, $response) use(&$count, $pool) {
if (count($pool) == 0) {
$redis = new Swoole\Coroutine\Redis();
$res = $redis->connect('127.0.0.1', 6379);
i... |
Use helpers instead of facade | <?php
namespace Lio\Exceptions;
use Auth;
use Bugsnag;
use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
... | <?php
namespace Lio\Exceptions;
use Bugsnag;
use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
*... |
Fix search:reindex to work with "doc" | <?php
namespace App\Console\Commands;
use Elasticsearch;
use App\Console\Helpers\Indexer;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class SearchReindex extends BaseCommand
{
use Indexer;
protected $signature = 'search:reindex
{dest : The prefix of the indexes to c... | <?php
namespace App\Console\Commands;
use Elasticsearch;
use App\Console\Helpers\Indexer;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class SearchReindex extends BaseCommand
{
use Indexer;
protected $signature = 'search:reindex
{dest : The prefix of the indexes to c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.