Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add test cases for unserialize() and isSerialized() | <?php
/*
* This file is part of the PHP Serialization Helpers package.
*
* © Chris Smith <chris@cs278.org>
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Cs278\SerializationHelpers\Tests;
use Cs278\SerializationHel... | |
Create a new smarty plugin for modules list to refactor code | <?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: block.tabset.php 25992 2010-03-08 16:46:30Z jonnybrad... | |
Add test case for @expectedDeprecation annotation | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
final cl... | |
Add listing delete object test | <?php
namespace ZpgRtf\Tests\Objects;
use ZpgRtf\Objects\ListingDeleteObject;
use PHPUnit\Framework\TestCase;
class ListingDeleteObjectTest extends TestCase
{
/**
* @var ListingDeleteObject
*/
protected $object;
public function setUp()
{
$this->object = new ListingDeleteObject();
... | |
Add content hash naming strategy | <?php
namespace FileNamingResolver\NamingStrategy;
use FileNamingResolver\FileInfo;
/**
* @author Victor Bocharsky <bocharsky.bw@gmail.com>
*/
class ContentHashNamingStrategy extends AbstractNamingStrategy
{
const ALGORITHM_MD5 = 'md5';
const ALGORITHM_SHA1 = 'sha1';
/**
* @var string Hash algori... | |
Add an action to concat data at value | <?php
namespace SpreadsheetsReplacement\Action;
/**
* Description of Concat
*
* @author florian
*/
class Concat extends Action {
private $start = '';
private $end = '';
/**
* Returns the string to add at start of the value.
* @return string the string
*/
public function getStart(... | |
Hide category when not specified | {{--
Copyright 2015-2017 ppy Pty. Ltd.
This file is part of osu!web. osu!web is distributed with the hope of
attracting more community contributions to the core ecosystem of osu!.
osu!web is free software: you can redistribute it and/or modify
it under the terms of the Affero GNU General Public Li... | {{--
Copyright 2015-2017 ppy Pty. Ltd.
This file is part of osu!web. osu!web is distributed with the hope of
attracting more community contributions to the core ecosystem of osu!.
osu!web is free software: you can redistribute it and/or modify
it under the terms of the Affero GNU General Public Li... |
Use cascade delete on foriegn keys | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CascadeDeleteForiegnKeys extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('signups', function ($table) {
$table-... | |
Add unit test for MimePartFactory | <?php
namespace ZBateson\MailMimeParser;
use PHPUnit_Framework_TestCase;
/**
* Description of HeaderPartFactoryTest
*
* @group MimePartFactory
* @author Zaahid Bateson
*/
class MimePartFactoryTest extends PHPUnit_Framework_TestCase
{
protected $mimePartFactory;
protected function setUp()
{
... | |
Create acceptance test for database update command | <?php
class DatabaseUpdateCommandTest extends AcceptanceTestCase
{
public function testExecute()
{
$output = $this->runConsole('db:update');
$this->assertContains('success', $output);
}
}
| |
Disable CSS animations during E2E. | <?php
/**
* Plugin Name: Disable CSS animations
* Description: Plugin for disabling CSS animations during E2E tests.
*/
function enqueue_disable_animations_stylesheet() {
$custom_css = '* { animation-duration: 0ms !important; }';
wp_add_inline_style( 'dashicons', $custom_css );
}
add_action( 'admin_enqueue_script... | |
Add a table for holding failed jobs. | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs'... | |
Remove the Customize icon from the customizer.php view. Redundant. | <?php
function shoestrap_footer_css() {
$bg = get_theme_mod( 'footer_bg' );
$cl = get_theme_mod( 'footer_color' );
echo '<style>';
echo 'footer.content-info{background:' . $bg . '; color:' . $cl . ';}';
echo '</style>';
}
add_action( 'wp_head', 'shoestrap_footer_css' );
/*
* Creates the customizer icon ... | <?php
function shoestrap_footer_css() {
$bg = get_theme_mod( 'footer_bg' );
$cl = get_theme_mod( 'footer_color' );
echo '<style>';
echo 'footer.content-info{background:' . $bg . '; color:' . $cl . ';}';
echo '</style>';
}
add_action( 'wp_head', 'shoestrap_footer_css' );
/*
* Creates the customizer icon on... |
Add tests for the content extentions add theme template page | <?php
namespace Backend\Modules\ContentBlocks\Tests\Action;
use Common\WebTestCase;
class AddThemeTemplateTest extends WebTestCase
{
public function testAuthenticationIsNeeded(): void
{
$client = static::createClient();
$this->logout($client);
$client->setMaxRedirects(1);
$cl... | |
Update script for system core | <?php
/**
* @package CleverStyle CMS
* @subpackage System module
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
$Config = Config::instance();
$co... | |
Add abstract class to avoid duplicate of checking input parameters | <?php
namespace CfdiUtils\CadenaOrigen;
abstract class AbstractXsltBuilder implements XsltBuilderInterface
{
protected function assertBuildArguments(string $xmlContent, string $xsltLocation): string
{
if ('' === $xmlContent) {
throw new \UnexpectedValueException('The XML content to transfor... | |
Allow to run tests by range via a custom suite | <?php
class CMTest_SplittedUnitTest {
public static function suite($suiteClassName) {
$matches = [];
$range = getenv('PHPUNIT_TEST_RANGE') ?: '';
if (preg_match('/(?P<chunk>\d+)\/(?P<parts>\d+)/', $range, $matches)) {
$chunk = (int) $matches['chunk'] - 1;
$parts = i... | |
Add unit test for Request | <?php
namespace Marein\Nchan\Http;
use PHPUnit\Framework\TestCase;
class RequestTest extends TestCase
{
/**
* @test
*/
public function itShouldBeCreatedWithItsValues(): void
{
$expectedUrl = 'http://localhost/my-url';
$expectedHeaders = ['Accept' => 'application/json'];
... | |
Add simple test for ConfigurationAnnotation | <?php
namespace Sensio\Bundle\FrameworkExtraBunde\Tests\Configuration;
class ConfigurationAnnotationTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException RuntimeException
*/
public function testUndefinedSetterThrowsException()
{
$this->getMockForAbstractClass('Sensio\Bundle... | |
Add tests for TestRunner\ExecutionStarted event | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\TestRunner;
use PHPUnit\Event\AbstractEven... | |
Add console command to reset user's authkey | <?php
/*
* Reset a password
*
* arg0 = email
* arg1 = new password
*/
class AuthkeyShell extends AppShell {
public $uses = array('User', 'Log');
public function main() {
if (!isset($this->args[0]) || empty($this->args[0])) echo 'MISP authkey reset command line tool.' . PHP_EOL . 'To assign a new authkey for ... | |
Fix PHP Notice Undefined variable "current_dc_id" | <?php
/**
* @package Core
* @subpackage externalWidgets
*/
class servefileAction extends sfAction
{
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$file_sync_id = $this->getRequestParameter( "id" );
$hash =... | <?php
/**
* @package Core
* @subpackage externalWidgets
*/
class servefileAction extends sfAction
{
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$file_sync_id = $this->getRequestParameter( "id" );
$hash =... |
Add marker image helper tests | <?php
namespace Ivory\GoogleMapBundle\Tests\Templating\Helper;
use Ivory\GoogleMapBundle\Templating\Helper\Overlays\MarkerImageHelper;
use Ivory\GoogleMapBundle\Templating\Helper\Base\PointHelper;
use Ivory\GoogleMapBundle\Templating\Helper\Base\SizeHelper;
use Ivory\GoogleMapBundle\Model\Overlays\MarkerImage;
use Iv... | |
Work on the register new customer method. | <?php
namespace Magium\Magento2\Actions\Checkout;
use Magium\Magento\Actions\Checkout\RegisterNewCustomerCheckout as M1Checkout;
use Magium\Magento\Actions\Checkout\Steps\NewCustomerPassword;
use Magium\Magento\Actions\Checkout\Steps\PaymentMethod;
use Magium\Magento\Actions\Checkout\Steps\PlaceOrder;
use Magium\Mage... | |
FIX Not being able to save when viewing page settings | <?php
/**
* @package cms
*/
class CMSPageSettingsController extends CMSMain {
private static $url_segment = 'pages/settings';
private static $url_rule = '/$Action/$ID/$OtherID';
private static $url_priority = 42;
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
private static $session_namespac... | <?php
/**
* @package cms
*/
class CMSPageSettingsController extends CMSMain {
private static $url_segment = 'pages/settings';
private static $url_rule = '/$Action/$ID/$OtherID';
private static $url_priority = 42;
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
private static $session_namespac... |
Add new test helpers newResolver and installCertificate | <?php
namespace CfdiUtilsTests;
use CfdiUtils\XmlResolver\XmlResolver;
class TestCase extends \PHPUnit\Framework\TestCase
{
public static function utilAsset(string $file)
{
return dirname(__DIR__) . '/assets/' . $file;
}
protected function downloadResourceIfNotExists(string $remote): string
... | <?php
namespace CfdiUtilsTests;
use CfdiUtils\Certificado\SatCertificateNumber;
use CfdiUtils\XmlResolver\XmlResolver;
class TestCase extends \PHPUnit\Framework\TestCase
{
public static function utilAsset(string $file)
{
return dirname(__DIR__) . '/assets/' . $file;
}
protected function newRe... |
Remove unused route in Files API | <?php
defined('C5_EXECUTE') or die("Access Denied.");
/**
* @var $router \Concrete\Core\Routing\Router
* @var $app \Concrete\Core\Application\Application
*/
$router->get('/file/{fID}', '\Concrete\Core\File\Api\FilesController::read')
->setRequirement('fID' ,'[0-9]+')
->setScopes('files:read');
$router->ge... | <?php
defined('C5_EXECUTE') or die("Access Denied.");
/**
* @var $router \Concrete\Core\Routing\Router
* @var $app \Concrete\Core\Application\Application
*/
$router->get('/file/{fID}', '\Concrete\Core\File\Api\FilesController::read')
->setRequirement('fID' ,'[0-9]+')
->setScopes('files:read');
|
Fix typo: $attributes to $attr. | <?php
require_once 'HTMLPurifier/AttrTransform.php';
// this MUST be placed in post, as it assumes that any value in dir is valid
HTMLPurifier_ConfigDef::define(
'Attr', 'DefaultTextDir', 'ltr',
'Defines the default text direction (ltr or rtl) of the document '.
'being parsed. This generally is the same... | <?php
require_once 'HTMLPurifier/AttrTransform.php';
// this MUST be placed in post, as it assumes that any value in dir is valid
HTMLPurifier_ConfigDef::define(
'Attr', 'DefaultTextDir', 'ltr',
'Defines the default text direction (ltr or rtl) of the document '.
'being parsed. This generally is the same... |
Add return types to trait methods | <?php
namespace DanDMartin\LoggerAware\Traits;
use Psr\Log\LoggerInterface as PsrLogger;
use DanDMartin\LoggerAware\Logger\NullLogger;
trait LoggerAware
{
/**
* @var PsrLogger
*/
protected $logger;
/**
* @param PsrLogger $l
* @required
*/
public function setLogger(PsrLogger $... | <?php
namespace DanDMartin\LoggerAware\Traits;
use Psr\Log\LoggerInterface as PsrLogger;
use DanDMartin\LoggerAware\Logger\NullLogger;
trait LoggerAware
{
/**
* @var PsrLogger
*/
protected $logger;
/**
* @param PsrLogger $l
* @required
*/
public function setLogger(PsrLogger $... |
Add test for formatting with a currency symbol | <?php namespace Nwidart\MoneyFormatter\Tests;
use Money\Currency;
use Money\Money;
use Nwidart\MoneyFormatter\MoneyFormatter;
class MoneyFormatterTest extends \PHPUnit_Framework_TestCase
{
/** @test */
public function should_format_as_english_pounds()
{
$formatter = new MoneyFormatter('en_GB');
... | <?php namespace Nwidart\MoneyFormatter\Tests;
use Money\Currency;
use Money\Money;
use Nwidart\MoneyFormatter\MoneyFormatter;
class MoneyFormatterTest extends \PHPUnit_Framework_TestCase
{
/** @test */
public function should_format_as_english_pounds()
{
$formatter = new MoneyFormatter('en_GB');
... |
Fix issue with https and Google analytics tracking code. | <?php ///////////////////////////////////////////////////////
// ----------------------------------------------------------
// SNIPPET
// ----------------------------------------------------------
// Google analytics.js
// ----------------------------------------------------------
// Enable and set analytics ID/API KEY... | <?php ///////////////////////////////////////////////////////
// ----------------------------------------------------------
// SNIPPET
// ----------------------------------------------------------
// Google analytics.js
// ----------------------------------------------------------
// Enable and set analytics ID/API KEY... |
Make container factory load all registered extensions dynamically | <?php
namespace Yolo;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Yolo\DependencyInjection\YoloExtension;
use Yolo\Compiler\EventSubscriberPass;
class Factory
{
public static function createContainer(array $parameters = [])
{
$container = new ContainerBuilder();
$container... | <?php
namespace Yolo;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Yolo\DependencyInjection\YoloExtension;
use Yolo\Compiler\EventSubscriberPass;
class Factory
{
public static function createContainer(array $parameters = [])
{
$container = new ContainerBuilder();
$container... |
Improve by using breadth search instead of depth search | <?php
class AlgorithmConnectedComponents extends Algorithm{
/**
*
* @var Graph
*/
private $graph;
/**
*
* @param Graph $graph
*/
public function __construct(Graph $graph){
$this->graph = $graph;
}
/**
* check whether this graph consist... | <?php
class AlgorithmConnectedComponents extends Algorithm{
/**
*
* @var Graph
*/
private $graph;
/**
*
* @param Graph $graph
*/
public function __construct(Graph $graph){
$this->graph = $graph;
}
/**
* check whether this graph consist... |
Remove possibly unwanted migration statement | <?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170322135321 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema... | <?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170322135321 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema... |
Load 1 image at a time | <?php
class DefaultController extends BaseController {
public function index()
{
return View::make('index');
}
public function load_content()
{
$ids = (Input::has('ids') ? Input::get('ids') : [0]);
return Response::json(Photo::whereNotIn('id', $ids)->take(5)->get());
}
}
| <?php
class DefaultController extends BaseController {
public function index()
{
return View::make('index');
}
public function load_content()
{
$ids = (Input::has('ids') ? Input::get('ids') : [0]);
return Response::json(Photo::whereNotIn('id', $ids)->take(1)->get());
}
}
|
Add tests for empty <del> and <ins> | <?php
class HTMLPurifier_HTMLModule_HTML5_EditTest extends BaseTestCase
{
public function testInsDel()
{
$this->assertPurification('<p>This was <del>deleted</del> <ins>added</ins>.</p>');
$this->assertPurification('<del><p>This paragraph has been deleted.</p></del>');
$this->assertPurif... | <?php
class HTMLPurifier_HTMLModule_HTML5_EditTest extends BaseTestCase
{
public function testInsDel()
{
$this->assertPurification('<p>This was <del>deleted</del> <ins>added</ins>.</p>');
$this->assertPurification('<del><p>This paragraph has been deleted.</p></del>');
$this->assertPuri... |
Fix test case for router | <?php
use Pagon\Router;
class RouterTest extends AppTest
{
/**
* @var Router
*/
protected $router;
public function setUp()
{
parent::setUp();
$this->router = $this->app->router;
}
public function testSetGet()
{
$closure = function ($req, $res) {
... | <?php
use Pagon\Router;
class RouterTest extends AppTest
{
/**
* @var Router
*/
protected $router;
public function setUp()
{
parent::setUp();
$this->router = $this->app->router;
}
public function testSetGet()
{
$closure = function ($req, $res) {
... |
Implement the contracts for password resets and pull in the traits | <?php
namespace Begin;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
}
| <?php
namespace Begin;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends ... |
Fix test by adding missing index | <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
class OrganismsTest extends PHPUnit_Framework_TestCase
{
public function testExecute()
{
list($service) = \WebService::factory('listing/Organisms');
$results = ($service->execute(array('limit' => 2)));
$this->asse... | <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
class OrganismsTest extends PHPUnit_Framework_TestCase
{
public function testExecute()
{
list($service) = \WebService::factory('listing/Organisms');
$results = ($service->execute(array('limit' => 2)));
$this->asse... |
Fix slug uniqueness check function | <?php
declare(strict_types=1);
namespace Knp\DoctrineBehaviors\Repository;
use Doctrine\ORM\EntityManagerInterface;
use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
final class DefaultSluggableRepository
{
/**
* @var EntityManagerInterface
*/
private $entityManager;
public functi... | <?php
declare(strict_types=1);
namespace Knp\DoctrineBehaviors\Repository;
use Doctrine\ORM\EntityManagerInterface;
use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
final class DefaultSluggableRepository
{
/**
* @var EntityManagerInterface
*/
private $entityManager;
public functi... |
Remove App duplication if only debugger data | <?php
namespace Sober\Controller;
class Blade
{
protected $data;
/**
* Set Data
*
* Remove other array items should last item not include tree
*/
protected function setBladeData($data)
{
// Get __blade/__debugger key
$this->data = $data['__data']['__blade'];
... | <?php
namespace Sober\Controller;
class Blade
{
protected $data;
/**
* Set Data
*
* Remove other array items should last item not include tree
*/
protected function setBladeData($data)
{
// Get __blade/__debugger key
$this->data = $data['__data']['__blade'];
... |
Fix for not to include the (empty) toolbar html when not displaying a label or buttons. |
<div class="btn-toolbar" role="toolbar">
@if (isset($label))
<div class="pull-left">
<h2>{!! $label !!}</h2>
</div>
@endif
@if (isset($buttons_left) && count($buttons_left))
<div class="pull-left">
@foreach ($buttons_left as $button) {!! $button !!}
@endforeach
</d... |
@if (
(isset($label) && strlen($label)) ||
(isset($buttons_left) && count($buttons_left)) ||
(isset($buttons_right) && count($buttons_right))
)
<div class="btn-toolbar" role="toolbar">
@if (isset($label) && strlen($label))
<div class="pull-left">
<h2>{!! $label !!}... |
Add the ability to get a token from an authorization code | <?php
namespace jamesiarmes\PEWS\API;
class ExchangeWebServicesAuth
{
public static function fromUsernameAndPassword($username, $password)
{
return array(
'curl' => array(
CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM,
CURLOPT_USERPWD => $username . ':'... | <?php
namespace jamesiarmes\PEWS\API;
use GuzzleHttp\Client;
class ExchangeWebServicesAuth
{
public static function fromUsernameAndPassword($username, $password)
{
return array(
'curl' => array(
CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM,
CURLOPT_US... |
Add helper classes to the event row | <table>
<thead>
<tr>
<th scope="col" class="date">Time</th>
<th scope="col" class="title">Event Title</th>
</tr>
</thead>
<tbody class="vcalendar">
<?php
$oddrow = false;
foreach ($context as $eventinstance) {
//Start building an ar... | <table>
<thead>
<tr>
<th scope="col" class="date">Time</th>
<th scope="col" class="title">Event Title</th>
</tr>
</thead>
<tbody class="vcalendar">
<?php
$oddrow = false;
foreach ($context as $eventinstance) {
//Start building an ar... |
Add the recent scope method for the user model to get the recently signed up users. | <?php namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Mod... | <?php namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Mod... |
Add missing param to DocBlock | <?php
namespace Laravel\Dusk;
use InvalidArgumentException;
class Dusk
{
/**
* Register the Dusk service provider.
*
* @return void
*/
public static function register(array $options = [])
{
if (static::duskEnvironment($options)) {
app()->register(DuskServiceProvide... | <?php
namespace Laravel\Dusk;
use InvalidArgumentException;
class Dusk
{
/**
* Register the Dusk service provider.
*
* @param array $options
* @return void
*/
public static function register(array $options = [])
{
if (static::duskEnvironment($options)) {
app... |
Set default string length to work around key too long errors | <?php
namespace RadDB\Providers;
use Laravel\Dusk\DuskServiceProvider;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Reg... | <?php
namespace RadDB\Providers;
use Laravel\Dusk\DuskServiceProvider;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Work around for MariaDB/M... |
Set PDO fetch mode when setting up database. | <?php
namespace FluxBB\Database;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Support\ServiceProvider;
class DatabaseServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->a... | <?php
namespace FluxBB\Database;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Support\ServiceProvider;
use PDO;
class DatabaseServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
... |
Add conflict to dyncss to ensure correct less rendering | <?php
/***************************************************************
* Extension Manager/Repository config file for ext "bootstrap_package".
***************************************************************/
$EM_CONF[$_EXTKEY] = array (
'title' => 'Bootstrap Package',
'description' => 'Boostrap Package deli... | <?php
/***************************************************************
* Extension Manager/Repository config file for ext "bootstrap_package".
***************************************************************/
$EM_CONF[$_EXTKEY] = array (
'title' => 'Bootstrap Package',
'description' => 'Boostrap Package deli... |
Use previously declared date helper | <?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date'); /* @var $dh \Concrete\Core\Localization\Service\Date */
$page = Page::getCurrentPage();
$date = Core::make('helper/date')->formatDate($page->getCollectionDatePublic(), true);
$user = UserInfo::getByID($page->getCollectionUserID());
... | <?php defined('C5_EXECUTE') or die("Access Denied.");
$dh = Core::make('helper/date'); /* @var $dh \Concrete\Core\Localization\Service\Date */
$page = Page::getCurrentPage();
$date = $dh->formatDate($page->getCollectionDatePublic(), true);
$user = UserInfo::getByID($page->getCollectionUserID());
?>
<div class="ccm-blo... |
Fix application status change email error | <?php
namespace App\Listeners\VisitTransfer;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Events\VisitTransfer\ApplicationStatusChanged;
class NotifyApplicantOfStatusChange implements ShouldQueue
{
public function __construct()
{
//
}
public function handle(ApplicationStatusChanged $e... | <?php
namespace App\Listeners\VisitTransfer;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Events\VisitTransfer\ApplicationStatusChanged as ApplicationStatusChangedEvent;
use App\Notifications\ApplicationStatusChanged;
class NotifyApplicantOfStatusChange implements ShouldQueue
{
public function __construct... |
Fix Config loading in DownloadCsv | <?php
namespace NemC\IP2LocLite\Commands;
use Illuminate\Console\Command,
NemC\IP2LocLite\Services\IP2LocLiteService,
NemC\IP2LocLite\Exceptions\NotLoggedInResponseException,
NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException;
class DownloadCsvCommand extends Command
{
protected $name = '... | <?php
namespace NemC\IP2LocLite\Commands;
use Illuminate\Console\Config,
Illuminate\Console\Command,
NemC\IP2LocLite\Services\IP2LocLiteService,
NemC\IP2LocLite\Exceptions\NotLoggedInResponseException,
NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException;
class DownloadCsvCommand extends Co... |
Use tabs instead of spaces | <?php
function backTrace($backtrace)
{
foreach ($backtrace as $bt) {
$args = '';
foreach ($bt['args'] as $a) {
if ($args) {
$args .= ', ';
}
if (in_array($bt['function'], array('RawQuery', 'Query', 'FetchResult')) && !$args)
$args... | <?php
function backTrace($backtrace)
{
foreach ($backtrace as $bt) {
$args = '';
foreach ($bt['args'] as $a) {
if ($args) {
$args .= ', ';
}
if (in_array($bt['function'], array('RawQuery', 'Query', 'FetchResult')) && !$args)
$args .= '"..."';
else
$args .= var_export($a, true);
}
$out... |
Make base repository class abstract. | <?php namespace Codesleeve\Fixture\Repositories;
class Repository
{
/**
* Generate an integer hash of a string.
* We'll use this method to convert a fixture's name into the
* primary key of it's corresponding database table record.
*
* @param string $value - This should be the name of the fixture.
* @ret... | <?php namespace Codesleeve\Fixture\Repositories;
abstract class Repository
{
/**
* Generate an integer hash of a string.
* We'll use this method to convert a fixture's name into the
* primary key of it's corresponding database table record.
*
* @param string $value - This should be the name of the fixture.... |
Make sure all handlers are valid CommandHandlers. | <?php
declare(strict_types = 1);
namespace Apha\CommandHandling;
use Apha\Message\Command;
class SimpleCommandBus extends CommandBus
{
/**
* @var array
*/
private $commandHandlerMap;
/**
* @param array $commandHandlerMap
*/
public function __construct(array $commandHandlerMap)
... | <?php
declare(strict_types = 1);
namespace Apha\CommandHandling;
use Apha\Message\Command;
class SimpleCommandBus extends CommandBus
{
/**
* @var array
*/
private $commandHandlerMap = [];
/**
* @param array $commandHandlerMap
*/
public function __construct(array $commandHandlerMa... |
Add new implemented event to test | <?php
namespace Muffin\Footprint\Test\TestCase\Event\Listener;
use Cake\Event\Event;
use Cake\ORM\Entity;
use Cake\TestSuite\TestCase;
use Muffin\Footprint\Event\FootprintListener;
class FootprintListenerTest extends TestCase
{
public function setUp()
{
$this->listener = new FootprintListener();
}... | <?php
namespace Muffin\Footprint\Test\TestCase\Event\Listener;
use Cake\Event\Event;
use Cake\ORM\Entity;
use Cake\TestSuite\TestCase;
use Muffin\Footprint\Event\FootprintListener;
class FootprintListenerTest extends TestCase
{
public function setUp()
{
$this->listener = new FootprintListener();
}... |
Set the IRC webchat widget's width to 100% | @extends('layouts/master')
@section('content')
<p>Come chat on Freenode at #capisso</p>
<iframe src="http://webchat.freenode.net?channels=capisso&uio=d4" width="647" height="400"></iframe>
@stop | @extends('layouts/master')
@section('content')
<p>Come chat on Freenode at #capisso</p>
<iframe src="http://webchat.freenode.net?channels=capisso&uio=d4" width="100%" height="400"></iframe>
@stop
|
Fix unused variable for $params | <?php namespace Picqer\Financials\Exact\Query;
class Resultset
{
protected $connection;
protected $url;
protected $class;
protected $params;
public function __construct($connection, $url, $class, $params)
{
$this->connection = $connection;
$this->url = $url;
$this->c... | <?php namespace Picqer\Financials\Exact\Query;
class Resultset
{
protected $connection;
protected $url;
protected $class;
protected $params;
public function __construct($connection, $url, $class, $params)
{
$this->connection = $connection;
$this->url = $url;
$this->c... |
Add theme column to users table | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
public function up() {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$ta... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
public function up() {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$ta... |
Index route should not use authentication | <?php
/**
* Register application routes.
*/
use App\Http\Controller;
use Corviz\Routing\Route;
Route::get('/', [
'controller' => Controller\Home::class,
'action' => 'index',
'alias' => 'home.index',
'middleware' => 'auth'
]);
| <?php
/**
* Register application routes.
*/
use App\Http\Controller;
use Corviz\Routing\Route;
Route::get('/', [
'controller' => Controller\Home::class,
'action' => 'index',
'alias' => 'home.index',
]);
|
Update snippet for send delivery confirmation feedback in PHP | <?php
$uniqueId = $_REQUEST['id'];
// Lookup variable `$uniqueId` in a database to find messageSid
$messageSid = 'SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// TODO: Implement | <?php
// Required if your envrionment does not handle autoloading
require __DIR__ . '/vendor/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
$uniqueId = $_REQUEST['id'];
// Lookup variable `$uniqueId` in a database to find messageSid
$messageSid = 'SMXXXXXXXXX... |
Add test case for new version of IUCN | <?php
namespace Test\AppBundle\API\Details;
use AppBundle\API\Details\OrganismsWithTrait;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;
class OrganismsWithTraitTest extends WebserviceTestCase
{
public function testExecute()
{
$default_db = $this->defau... | <?php
namespace Test\AppBundle\API\Details;
use AppBundle\API\Details\OrganismsWithTrait;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;
class OrganismsWithTraitTest extends WebserviceTestCase
{
public function testExecute()
{
$default_db = $this->defau... |
Test issue with expected exception | <?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\BlockBundle\Tests\Block;
use Sonata\BlockBundle\Block\... | <?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\BlockBundle\Tests\Block;
use Sonata\BlockBundle\Block\... |
Fix built-in server for PHP > 5.4.1 | <?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.
*/
/*
* This file implements rewrite rules for PHP built-in web server.
*
* See: h... | <?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.
*/
/*
* This file implements rewrite rules for PHP built-in web server.
*
* See: h... |
FIX Add namespaces for Extension and TestOnly | <?php
namespace BringYourOwnIdeas\Maintenance\Tests\Reports\Stubs;
use Extension;
use TestOnly;
class SiteSummaryExtensionStub extends Extension implements TestOnly
{
public function updateAlerts(&$alerts)
{
$alerts[] = '<p><strong>Alert! Alert!</strong> <br />Sound the alarm!</p>';
}
}
| <?php
namespace BringYourOwnIdeas\Maintenance\Tests\Reports\Stubs;
use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly;
class SiteSummaryExtensionStub extends Extension implements TestOnly
{
public function updateAlerts(&$alerts)
{
$alerts[] = '<p><strong>Alert! Alert!</strong> <br />Sound... |
Add constructor with working directory in composer command | <?php namespace Szykra\GitLabReceiver\CommandListeners;
class ComposerCommandListener extends AbstractCommandListener {
/**
* @var string
*/
protected $command = "composer";
/**
* @param $data
* @return bool
*/
public function run($data)
{
$this->log('Start compos... | <?php namespace Szykra\GitLabReceiver\CommandListeners;
class ComposerCommandListener extends AbstractCommandListener {
/**
* @var string
*/
protected $command = "composer";
/**
* @var string
*/
protected $directory;
/**
* @param $directory
*/
function __constru... |
Enhance Business Unit Test coverage | <?php
use Illuminate\Foundation\Testing\DatabaseTransactions;
class BusinessUnitTest extends TestCase
{
use DatabaseTransactions;
public function testBusinessCreationWithSuccess()
{
$business = factory(App\Business::class)->create();
$this->seeInDatabase('businesses', ['slug' => $busines... | <?php
use App\Business;
use App\Presenters\BusinessPresenter;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class BusinessUnitTest extends TestCase
{
use DatabaseTransactions;
/**
* @covers \App\Business::create
*/
public function testCreatedBusinessGetsStoredInDatabase()
... |
Add separated method that adds user referer into DB | <?php
/**
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Module / Affiliate / ... | <?php
/**
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Module / Affiliate / ... |
Add settings for Clone plugin | <?php
namespace NamelessCoder\GizzleGitPlugins\GizzlePlugins;
use NamelessCoder\Gizzle\Payload;
use NamelessCoder\Gizzle\PluginInterface;
/**
* Class ClonePlugin
*/
class ClonePlugin extends AbstractGitPlugin implements PluginInterface {
/**
* @var array
*/
protected $settings = array();
/**
* Initialize... | <?php
namespace NamelessCoder\GizzleGitPlugins\GizzlePlugins;
use NamelessCoder\Gizzle\Payload;
use NamelessCoder\Gizzle\PluginInterface;
/**
* Class ClonePlugin
*/
class ClonePlugin extends AbstractGitPlugin implements PluginInterface {
const OPTION_DIRECTORY = 'directory';
const OPTION_REPOSITORY = 'repository... |
Add TokenMismatchException to the dontReport array | <?php
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionH... | <?php
namespace App\Exceptions;
use Exception;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illumin... |
Add support for flash messages | <?php
namespace Framework;
class Controller {
private $app;
private $api;
function __construct($app){
$this->app = $app;
}
protected function setHeader($header, $value)
{
$this->app->response->headers->set($header, $value);
}
protected function setLayout($layout) {
$this->app->view->setLayout($layou... | <?php
namespace Framework;
class Controller {
private $app;
private $api;
function __construct($app){
$this->app = $app;
}
protected function setHeader($header, $value)
{
$this->app->response->headers->set($header, $value);
}
protected function setLayout($layout) {
$this->app->view->setLayout($layou... |
Update Something Positive plugin for 1.7.9 compatibility | <?php
class Af_SomethingPositive extends Plugin {
function about() {
return array(0.1, "Fetch image from Something Positive webcomic", "Markus Wiik");
}
function init($host) {
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
}
function hook_article_filter($article) {
$o... | <?php
class Af_SomethingPositive extends Plugin {
function about() {
return array(0.1, "Fetch image from Something Positive webcomic", "Markus Wiik");
}
function init($host) {
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
}
function hook_article_filter($article) {
$o... |
Remove redundant lookup from field type process | <?php
namespace Statamic\Addons\LinkOgData;
use Statamic\Extend\Fieldtype;
class LinkOgDataFieldtype extends Fieldtype
{
protected function init()
{
$this->linkogdata = new LinkOgData;
}
/**
* The blank/default value
*
* @return array
*/
public function blank()
{
... | <?php
namespace Statamic\Addons\LinkOgData;
use Statamic\Extend\Fieldtype;
class LinkOgDataFieldtype extends Fieldtype
{
/**
* The blank/default value
*
* @return array
*/
public function blank()
{
return [
'url' => null
];
}
/**
* Pre-process... |
Deploy on push, test 9 | <?php
// Parse the json payload from github
$json = file_get_contents('php://input');
$obj = json_decode($json);
// If there is a playload, deploy the website
if ( $obj ) {
// Log the payload
file_put_contents('log/payload.txt', date("\n[d M Y H:i:s]\n").print_r($obj, true), FILE_AP... | <?php
// Parse the json payload from github
$json = file_get_contents('php://input');
$obj = json_decode($json);
// If there is a playload, deploy the website
if ( $obj ) {
// Log the payload
file_put_contents('log/payload.txt', date("\n[d M Y H:i:s]\n").print_r($obj, true), FILE_AP... |
Correct the hostname option (smtpServer) | <?php
namespace duncan3dc\SwiftMailer;
class Mailer extends Email
{
public function __construct(array $options = null)
{
if (!is_array($options)) {
$options = [];
}
if (empty($options["hostname"])) {
$hostname = "localhost";
} else {
$hostn... | <?php
namespace duncan3dc\SwiftMailer;
class Mailer extends Email
{
public function __construct(array $options = null)
{
if (!is_array($options)) {
$options = [];
}
if (empty($options["smtpServer"])) {
$hostname = "localhost";
} else {
$hos... |
Fix the token request and log level | <?php
namespace APIBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Controller\Annotations as Rest;
use Nelmio\ApiDocBundle\Ann... | <?php
namespace APIBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Controller\Annotations as Rest;
use Nelmio\ApiDocBundle\Ann... |
Use menu name as accessible name of `<nav>` | <header class="banner">
<a class="brand" href="{{ home_url('/') }}">
{{ $siteName }}
</a>
@if (has_nav_menu('primary_navigation'))
<nav class="nav-primary">
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav', 'echo' => false]) !!}
</nav>
@endif
</header>
| <header class="banner">
<a class="brand" href="{{ home_url('/') }}">
{{ $siteName }}
</a>
@if (has_nav_menu('primary_navigation'))
<nav class="nav-primary" aria-label="{{wp_get_nav_menu_name('primary_navigation')}}">
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav', ... |
Use new core API for modifying WebAppView properties | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Embed;
use Flarum\Forum\WebApp;
class EmbedWebApp extends WebApp
{
/**
... | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Embed;
use Flarum\Forum\WebApp;
class EmbedWebApp extends WebApp
{
/**
... |
Allow empty Google Map API key | <?php
/**
* (c) FSi sp. z o.o. <info@fsi.pl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace FSi\Bundle\FormExtensionsBundle\Twig;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class... | <?php
/**
* (c) FSi sp. z o.o. <info@fsi.pl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace FSi\Bundle\FormExtensionsBundle\Twig;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
class... |
Remove unused class that caused the error | <?php
/*
* This file is part of the Doctrine\OrientDB package.
*
* (c) Alessandro Nadalin <alessandro.nadalin@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Class Updates
*
* @package Doctrine\OrientDB
*... | <?php
/*
* This file is part of the Doctrine\OrientDB package.
*
* (c) Alessandro Nadalin <alessandro.nadalin@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Class Updates
*
* @package Doctrine\OrientDB
*... |
Fix CORS issue with React App | <?php
/**
* Public store inforamtion in JSON format
*
* @author Chris Rogers
* @since 2019-02-22
*/
class NaturalRemedyCo_NRCLayout_IndexController extends Mage_Core_Controller_Front_Action
{
/**
* @var Mage_Core_Model_Store
*/
protected $_store;
/**
* Magento's specific construtor (notice the singl... | <?php
/**
* Public store inforamtion in JSON format
*
* @author Chris Rogers
* @since 2019-02-22
*/
class NaturalRemedyCo_NRCLayout_IndexController extends Mage_Core_Controller_Front_Action
{
/**
* @var Mage_Core_Model_Store
*/
protected $_store;
/**
* Magento's specific construtor (notice the singl... |
Fix exception to use the filename instead of a blank string. | <?php
namespace Sprockets\Filter;
use Sprockets\File;
class Scss extends Base
{
private $parser;
public function __construct()
{
$previous_error_reporting = error_reporting();
error_reporting(E_ERROR);
$this->parser = new \SassParser(array('syntax' => \SassFile::SCSS));
error_reporting($previous_error_r... | <?php
namespace Sprockets\Filter;
use Sprockets\File;
class Scss extends Base
{
private $parser;
public function __construct()
{
$previous_error_reporting = error_reporting();
error_reporting(E_ERROR);
$this->parser = new \SassParser(array('syntax' => \SassFile::SCSS));
error_reporting($previous_error_r... |
Rename method Str::limitWords to Str::words | <?php
use Illuminate\Support\Str;
class SupportStrTest extends PHPUnit_Framework_TestCase
{
/**
* Test the Str::limitWords method.
*
* @group laravel
*/
public function testStringCanBeLimitedByWords()
{
$this->assertEquals('Taylor...', Str::limitWords('Taylor Otwell', 1));
$this->assertEqual... | <?php
use Illuminate\Support\Str;
class SupportStrTest extends PHPUnit_Framework_TestCase
{
/**
* Test the Str::words method.
*
* @group laravel
*/
public function testStringCanBeLimitedByWords()
{
$this->assertEquals('Taylor...', Str::words('Taylor Otwell', 1));
$this->assertEquals('Taylor_... |
Fix selected value for select field. | <div class="{{$config['divClass']}} {{$wrapperClass}} @if($errors)f-error @endif">
@if($label) <label for="{{$name}}">{!! $label !!} @if($required)<i class="f-required">*</i>@endif</label>@endif
<select
id="{{$name}}"
name="{{$name}}"
@if($value)value="{{$value}}" @endif
@if($required)required @... | <div class="{{$config['divClass']}} {{$wrapperClass}} @if($errors)f-error @endif">
@if($label) <label for="{{$name}}">{!! $label !!} @if($required)<i class="f-required">*</i>@endif</label>@endif
<select
id="{{$name}}"
name="{{$name}}"
@if($value)value="{{$value}}" @endif
@if($required)required @... |
Stop "git blame" from printing "^" markers on root repository commits | <?php
final class DiffusionGitBlameQuery extends DiffusionBlameQuery {
protected function newBlameFuture(DiffusionRequest $request, $path) {
$repository = $request->getRepository();
$commit = $request->getCommit();
return $repository->getLocalCommandFuture(
'--no-pager blame -s -l %s -- %s',
... | <?php
final class DiffusionGitBlameQuery extends DiffusionBlameQuery {
protected function newBlameFuture(DiffusionRequest $request, $path) {
$repository = $request->getRepository();
$commit = $request->getCommit();
// NOTE: The "--root" flag suppresses the addition of the "^" boundary
// commit ma... |
Fix "Array to string conversion" bug related to errorParams | <?php
$this->data['header'] = $this->t('{userid:error:header}');
$this->data['head'] = <<<EOF
<meta name="robots" content="noindex, nofollow" />
<meta name="googlebot" content="noarchive, nofollow" />
EOF;
$this->includeAtTemplateBase('includes/header.php');
?>
<h2><?php echo $this->t('{userid:error:title}'); ?></h2>... | <?php
$this->data['header'] = $this->t('{userid:error:header}');
$this->data['head'] = <<<EOF
<meta name="robots" content="noindex, nofollow" />
<meta name="googlebot" content="noarchive, nofollow" />
EOF;
$this->includeAtTemplateBase('includes/header.php');
$translationParams = [
'%IDPNAME%' => $this->data['para... |
Document @cache-store and @config-store used. | <?php
/**
* SimpleComplex PHP Config
* @link https://github.com/simplecomplex/php-config
* @copyright Copyright (c) 2017 Jacob Friis Mathiasen
* @license https://github.com/simplecomplex/php-config/blob/master/LICENSE (MIT License)
*/
declare(strict_types=1);
namespace SimpleComplex\Config;
/**
* Conveni... | <?php
/**
* SimpleComplex PHP Config
* @link https://github.com/simplecomplex/php-config
* @copyright Copyright (c) 2017 Jacob Friis Mathiasen
* @license https://github.com/simplecomplex/php-config/blob/master/LICENSE (MIT License)
*/
declare(strict_types=1);
namespace SimpleComplex\Config;
/**
* Conveni... |
Update call to arguments to inputs | <?php
/**
* @file
* Contains \Drupal\AppConsole\EventSubscriber\CallCommandListener.
*/
namespace Drupal\AppConsole\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Input\ArrayInput;
use Drupal\... | <?php
/**
* @file
* Contains \Drupal\AppConsole\EventSubscriber\CallCommandListener.
*/
namespace Drupal\AppConsole\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Input\ArrayInput;
use Drupal\... |
Fix fatal error on delete actions | <?php namespace Flarum\Api\Actions;
use Flarum\Api\Request;
use Zend\Diactoros\Response;
abstract class DeleteAction extends JsonApiAction
{
/**
* Delegate deletion of the resource, and return a 204 No Content
* response.
*
* @param \Flarum\Api\Request $request
* @return \Psr\Http\Message... | <?php namespace Flarum\Api\Actions;
use Flarum\Api\Request;
use Zend\Diactoros\Response;
abstract class DeleteAction extends JsonApiAction
{
/**
* Delegate deletion of the resource, and return a 204 No Content
* response.
*
* @param \Flarum\Api\Request $request
* @return \Psr\Http\Message... |
Add provider field for future use | <?php
namespace Zeropingheroes\Lanager\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Game extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
... | <?php
namespace Zeropingheroes\Lanager\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Game extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
... |
Fix repo detection for https urls | <?php
namespace Berti;
use Github;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Process\Process;
function github_markdown_renderer(
Github\Client $client,
callable $repositoryDetector,
SplFileInfo $document
): string
{
return $client->api('markdown')->render(
$document->get... | <?php
namespace Berti;
use Github;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Process\Process;
function github_markdown_renderer(
Github\Client $client,
callable $repositoryDetector,
SplFileInfo $document
): string
{
return $client->api('markdown')->render(
$document->get... |
Check to see if user already exists for email | <?php
require_once('../includes/config.php');
$errors = array();
$data = array();
if(isset($_POST['_csrf']) && session_csrf_check($_POST['_csrf'])) {
$recaptcha = new \ReCaptcha\ReCaptcha($config['captcha']['priv'], new \ReCaptcha\RequestMethod\CurlPost());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'])... | <?php
require_once('../includes/config.php');
$errors = array();
$data = array();
if(isset($_POST['_csrf']) && session_csrf_check($_POST['_csrf'])) {
$recaptcha = new \ReCaptcha\ReCaptcha($config['captcha']['priv'], new \ReCaptcha\RequestMethod\CurlPost());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'])... |
Document the coefficient equality convergence test. | <?php
namespace mcordingley\Regression\Algorithm\GradientDescent\StoppingCriteria;
final class CoefficientEquality implements StoppingCriteria
{
private $oldCoefficients;
/**
* @param array $gradient
* @param array $coefficients
* @return bool
*/
public function converged(array $gradi... | <?php
namespace mcordingley\Regression\Algorithm\GradientDescent\StoppingCriteria;
/**
* Checks for when the coefficients themselves have completely stopped changing.
* This represents a complete convergence of the descent, but can take a long
* time to occur, as the update for each weight must become smaller than... |
Add Pin & Stripe Request classes | <?php
/*
* This file is part of the Omnipay package.
*
* (c) Adrian Macneil <adrian@adrianmacneil.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Omnipay\PayPal\Message;
use Symfony\Component\HttpFoundation\Reques... | <?php
/*
* This file is part of the Omnipay package.
*
* (c) Adrian Macneil <adrian@adrianmacneil.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Omnipay\PayPal\Message;
/**
* PayPal Express Complete Authorize Re... |
Support JWT as a Bearer token | <?php
namespace hiapi\Core\Auth;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
abstract class AuthMiddleware implements MiddlewareInterface
{
/**
* @inheritDoc
*/
public func... | <?php
namespace hiapi\Core\Auth;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
abstract class AuthMiddleware implements MiddlewareInterface
{
/**
* @inheritDoc
*/
public func... |
Put text for radio elements into label tags | <?php
namespace vxPHP\Form\FormElement\FormElementWithOptions;
use vxPHP\Form\FormElement\FormElementWithOptions\FormElementFragment;
/**
* a single option belonging to a group of <input type="option"> elements
* sharing the same name
*
* @author Gregor Kofler
* @version 0.4.0 2015-01-24
*/
class RadioOptionEl... | <?php
namespace vxPHP\Form\FormElement\FormElementWithOptions;
use vxPHP\Form\FormElement\FormElementWithOptions\FormElementFragment;
/**
* a single option belonging to a group of <input type="option"> elements
* sharing the same name
*
* @author Gregor Kofler
* @version 0.4.1 2015-11-14
*/
class RadioOptionEl... |
Fix a problem with multiple choice fields in a query | <?php
namespace Lexik\Bundle\FormFilterBundle\Filter\Extension\Type;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Expr;
/**
* Filter type for select list.
*
* @author Cédric Girard <c.girard@lexik.fr>
*/
class ChoiceFilte... | <?php
namespace Lexik\Bundle\FormFilterBundle\Filter\Extension\Type;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Expr;
/**
* Filter type for select list.
*
* @author Cédric Girard <c.girard@lexik.fr>
*/
class ChoiceFilte... |
Fix errors reported by php-cs-fixer | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 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-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... |
Add helper method to get Categories as array | <?php
/**
* Manages category names.
*
* @copyright Copyright (c) 2011 Poluza.
* @author Andrew Udvare [au] <andrew@poluza.com>
* @license http://www.opensource.org/licenses/mit-license.php
*
* @package SutraModel
* @link http://www.example.com/
*
* @version 1.0
*/
class Category extends fActiveRecord {
/**... | <?php
/**
* Manages category names.
*
* @copyright Copyright (c) 2011 Poluza.
* @author Andrew Udvare [au] <andrew@poluza.com>
* @license http://www.opensource.org/licenses/mit-license.php
*
* @package SutraModel
* @link http://www.example.com/
*
* @version 1.0
*/
class Category extends fActiveRecord {
/**... |
Add alerts messages and randomize time between alerts | <?php
define("SECONDS_BETWEEN_ALERTS", 10);
date_default_timezone_set("Europe/Madrid");
header("Content-Type: text/event-stream\n\n");
while (true) {
sendAlert("Test alert");
ob_end_flush();
flush();
sleep(SECONDS_BETWEEN_ALERTS);
}
function sendAlert($messag... | <?php
define("SECONDS_BETWEEN_ALERTS", rand(5, 15));
$alerts = array(
"Coldest Air of the Season Sweeping Through Central and Southern States",
"Belgium on 'high alert'",
"Multiple raids in Brussels as police seek ISIS terrorists",
"Syria fighters may be fueled by amphetamines"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.