Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Set User-Agent to fix gist imports | <?php
if (!isset($_GET['url'])) die();
$url = urldecode($_GET['url']);
if (strpos($url, 'http://', 0) !== 0 && strpos($url, 'https://', 0) !== 0) die();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
curl_close($ch);
if ($co... | <?php
if (!isset($_GET['url'])) die();
$url = urldecode($_GET['url']);
if (strpos($url, 'http://', 0) !== 0 && strpos($url, 'https://', 0) !== 0) die();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Age... |
Fix path prefixing on unix | <?php
namespace Isaac\Services\Filesystem;
use League\Flysystem\Adapter\Local;
/**
* A fork of the Local adapter that grants us permissions to any absolute path
* instead of working with relative paths.
*/
class AbsoluteLocal extends Local
{
/**
* LooseLocal constructor.
*/
public function __con... | <?php
namespace Isaac\Services\Filesystem;
use League\Flysystem\Adapter\Local;
/**
* A fork of the Local adapter that grants us permissions to any absolute path
* instead of working with relative paths.
*/
class AbsoluteLocal extends Local
{
/**
* LooseLocal constructor.
*/
public function __con... |
Add method to extract unique cities from locations array | <?php
namespace SepomexPhp;
class Locations implements \IteratorAggregate, \Countable
{
/** @var Location[] */
private $collection;
public function __construct(Location ...$location)
{
$this->collection = $location;
}
public function getIterator()
{
return new \ArrayIterat... | <?php
namespace SepomexPhp;
class Locations implements \IteratorAggregate, \Countable
{
/** @var Location[] */
private $collection;
public function __construct(Location ...$location)
{
$this->collection = $location;
public static function extractUniqueCities(Location ...$locations): Citie... |
Fix page ID for sanity check page... | <?php
$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');
$info = array();
$errors = array();
$hookinfo = array(
'info' => &$info,
'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
if (isset($_REQUEST['output... | <?php
$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');
$info = array();
$errors = array();
$hookinfo = array(
'info' => &$info,
'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
if (isset($_REQUEST['output... |
Update error controller to work with twig | <?php
namespace App;
class ErrorController
{
/**
* Array of error template filenames
*
* @var string[]
*/
protected $templates = [
'error/{code}',
'error/{code}X',
'error/{code}XX',
'error/default',
];
/**
* Test index action
*
* @a... | <?php
namespace App\Controller;
use App\Application;
use App\Controller;
class ErrorController extends Controller
{
/**
* Array of error template filenames
*
* @var string[]
*/
protected $templates = [
'error/{code}',
'error/{code}X',
'error/{code}XX',
'er... |
Add presenter as last argument(?) | <?php
if (is_dir($vendor = __DIR__ . '/../vendor')) {
require_once($vendor . '/autoload.php');
} elseif (is_dir($vendor = __DIR__ . '/../../../vendor')) {
require_once($vendor . '/autoload.php');
} elseif (is_dir($vendor = __DIR__ . '/vendor')) {
require_once($vendor . '/autoload.php');
} else {
die(
... | <?php
if (is_dir($vendor = __DIR__ . '/../vendor')) {
require_once($vendor . '/autoload.php');
} elseif (is_dir($vendor = __DIR__ . '/../../../vendor')) {
require_once($vendor . '/autoload.php');
} elseif (is_dir($vendor = __DIR__ . '/vendor')) {
require_once($vendor . '/autoload.php');
} else {
die(
... |
Fix null error when there's no data | <?php
namespace App\Http\Controllers;
use App\Services\Ranking;
use App\Services\Slack;
use App\SlackProp;
use App\SlackUser;
class DashboardController extends Controller
{
public function index()
{
$ranking = Ranking::getRanking();
$props = SlackProp::query()->orderBy('created_at', 'DESC')->... | <?php
namespace App\Http\Controllers;
use App\Services\Ranking;
use App\Services\Slack;
use App\SlackProp;
use App\SlackUser;
class DashboardController extends Controller
{
public function index()
{
$ranking = Ranking::getRanking();
$props = SlackProp::query()->orderBy('created_at', 'DESC')->... |
Fix xss issue with search synonym datagrids | <?php
namespace Backend\Modules\Search\Actions;
use Backend\Core\Engine\Base\Action;
use Backend\Core\Engine\Authentication as BackendAuthentication;
use Backend\Core\Engine\DataGridDatabase as BackendDataGridDatabase;
use Backend\Core\Language\Language as BL;
use Backend\Core\Engine\Model as BackendModel;
use Backen... | <?php
namespace Backend\Modules\Search\Actions;
use Backend\Core\Engine\Base\Action;
use Backend\Core\Engine\Authentication as BackendAuthentication;
use Backend\Core\Engine\DataGridDatabase as BackendDataGridDatabase;
use Backend\Core\Language\Language as BL;
use Backend\Core\Engine\Model as BackendModel;
use Backen... |
Fix replying to admin box messages | <?php declare(strict_types=1);
$message = trim(Request::get('message'));
$banPoints = Request::getInt('BanPoints');
$rewardCredits = Request::getInt('RewardCredits');
if (Request::get('action') == 'Preview message') {
$container = create_container('skeleton.php', 'box_reply.php');
$container['BanPoints'] = $banPoint... | <?php declare(strict_types=1);
$message = trim(Request::get('message'));
$banPoints = Request::getInt('BanPoints');
$rewardCredits = Request::getInt('RewardCredits');
if (Request::get('action') == 'Preview message') {
$container = create_container('skeleton.php', 'box_reply.php');
$container['BanPoints'] = $banPoint... |
Add a test to verify service name-based transformers. | <?php
namespace Crell\TransformerBundle\Tests;
use Crell\Transformer\Tests\MethodConverterTest;
use Crell\Transformer\Tests\TestA;
use Crell\Transformer\Tests\TestB;
use Crell\Transformer\Tests\TransformerBusTest;
use Crell\TransformerBundle\ContainerAwareTransformerBus;
use Symfony\Component\DependencyInjection\Cont... | <?php
namespace Crell\TransformerBundle\Tests;
use Crell\Transformer\Tests\MethodConverterTest;
use Crell\Transformer\Tests\TestA;
use Crell\Transformer\Tests\TestB;
use Crell\Transformer\Tests\TransformerBusTest;
use Crell\TransformerBundle\ContainerAwareTransformerBus;
use Symfony\Component\DependencyInjection\Cont... |
Make this slightly less as simple as possible | <?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\Util\Metadata;
/**
* @internal This class is no... | <?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\Util\Metadata;
use PHPUnit\Util\Metadata\Annotat... |
Remove unused code (codavy issue) | <?php
namespace Bauhaus\DependencyInjection;
class FakeService
{
private $privAttr1 = 'someValue';
private $privAttr2 = null;
private $privAttr3 = null;
public $pubAttr1 = 123;
public $pubAttr2 = 'bla';
public $pubAttr3 = null;
public function __construct()
{
$this->privAttr2 ... | <?php
namespace Bauhaus\DependencyInjection;
class FakeService
{
private $privAttr1 = null;
public $pubAttr1 = 123;
public $pubAttr2 = 'bla';
public $pubAttr3 = null;
public function __construct()
{
$this->privAttr1 = 'aeiou';
}
}
|
Move deferred command additions to be processed after `'after_wp_load'` hook. | <?php
namespace WP_CLI\Bootstrap;
/**
* Class RegisterDeferredCommands.
*
* Registers the deferred commands that for which no parent was registered yet.
* This is necessary, because we can have sub-commands that have no direct
* parent, like `wp network meta`.
*
* @package WP_CLI\Bootstrap
*/
final class Regi... | <?php
namespace WP_CLI\Bootstrap;
/**
* Class RegisterDeferredCommands.
*
* Registers the deferred commands that for which no parent was registered yet.
* This is necessary, because we can have sub-commands that have no direct
* parent, like `wp network meta`.
*
* @package WP_CLI\Bootstrap
*/
final class Regi... |
Change action properties to be protected so it will serialize | <?php
declare(strict_types=1);
namespace LotGD\Core;
/**
* A representation of an action the user can take to affect the game
* state. An encapsulation of a navigation menu option.
*/
class Action
{
private $id;
private $destinationSceneId;
/**
* Construct a new action with the specified Scene as... | <?php
declare(strict_types=1);
namespace LotGD\Core;
/**
* A representation of an action the user can take to affect the game
* state. An encapsulation of a navigation menu option.
*/
class Action
{
protected $id;
protected $destinationSceneId;
/**
* Construct a new action with the specified Scen... |
Simplify widget generators list command class. | <?php
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2015, 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 Darvin\AdminBundle\Comma... | <?php
/**
* @author Igor Nikolaev <igor.sv.n@gmail.com>
* @copyright Copyright (c) 2015, 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 Darvin\AdminBundle\Comma... |
Fix BuzzAPI response format for bad GTID | <?php
declare(strict_types=1);
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
// phpcs:disable SlevomatCodingStandard.Functions.UnusedParameter
namespace App\Http\Controllers;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class BuzzApiMockController extends Controller
{
public f... | <?php
declare(strict_types=1);
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
// phpcs:disable SlevomatCodingStandard.Functions.UnusedParameter
namespace App\Http\Controllers;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class BuzzApiMockController extends Controller
{
public f... |
Set key to index against | <?php
namespace Michaeljennings\Laralastica\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
class IndexModels
{
use Queueable, SerializesModels, InteractsWithQueue;
/**
* The models to be in... | <?php
namespace Michaeljennings\Laralastica\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
class IndexModels
{
use Queueable, SerializesModels, InteractsWithQueue;
/**
* The models to be in... |
Refactor "result" method: call fetch_all with MYSQLI_ASSOC | <?php
/**
* This file is part of the Crystal package.
*
* (c) Sergey Novikov (novikov.stranger@gmail.com)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Date: 16.12.2014
* Time: 16:26
*/
namespace core\db_drivers\query_result... | <?php
/**
* This file is part of the Crystal package.
*
* (c) Sergey Novikov (novikov.stranger@gmail.com)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Date: 16.12.2014
* Time: 16:26
*/
namespace core\db_drivers\query_result... |
Add tests for number casting and float comparison. | <?php
/*
* (c) Andreas Fischer <bantu@owncloud.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Tests math related to large file sizes.
*/
class MathTest extends PHPUnit_Framework_TestCase
{
public function testLargeFloatS... | <?php
/*
* (c) Andreas Fischer <bantu@owncloud.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Tests math related to large file sizes.
*/
class MathTest extends PHPUnit_Framework_TestCase
{
public function testFloatEquali... |
Fix condition, make sure not to include non-pivot relations | <?php
class EloquentBuilder extends \Illuminate\Database\Eloquent\Builder
{
/**
* Eager load pivot relations.
*
* @param array $models
* @return void
*/
protected function loadPivotRelations($models)
{
$query = head($models)->pivot->newQuery()->with('unit');
$pivot... | <?php
class EloquentBuilder extends \Illuminate\Database\Eloquent\Builder
{
/**
* Eager load pivot relations.
*
* @param array $models
* @return void
*/
protected function loadPivotRelations($models)
{
$query = head($models)->pivot->newQuery()->with('unit');
$pivot... |
Return the mail function result. | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = strip_tags(htmlspecialchars($_POST['name']... | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = strip_tags(htmlspecialchars($_POST['name']));
$e... |
Change check on finished and started | <?php
/**
* @file
* Template for the calendar add or view buttons.
* Leave the wrapper div class + print classes + data-eventid, as it is used for javascript.
*/
?>
<div class="<?php print $classes; ?>" data-eventid="<?php print $event_id; ?>">
<?php if (!$finished && $started) : ?>
<?php print t('This event... | <?php
/**
* @file
* Template for the calendar add or view buttons.
* Leave the wrapper div class + print classes + data-eventid, as it is used for javascript.
*/
?>
<div class="<?php print $classes; ?>" data-eventid="<?php print $event_id; ?>">
<?php if ($started) : ?>
<?php print t('This event is already st... |
Change hexadecimal number in a string issue level to warning | <?php
namespace Sstalle\php7cc\NodeVisitor;
use PhpParser\Node;
use Sstalle\php7cc\CompatibilityViolation\Message;
class HexadecimalNumberStringVisitor extends AbstractVisitor
{
const LEVEL = Message::LEVEL_ERROR;
public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String_)... | <?php
namespace Sstalle\php7cc\NodeVisitor;
use PhpParser\Node;
use Sstalle\php7cc\CompatibilityViolation\Message;
class HexadecimalNumberStringVisitor extends AbstractVisitor
{
const LEVEL = Message::LEVEL_WARNING;
public function enterNode(Node $node)
{
if (!$node instanceof Node\Scalar\String... |
Add debug to $app config | <?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$app = array();
$app['config'] = array(
'db' => array(
'dsn' => 'mysql:dbname=foler;host=localhost',
'user' => 'root',
'password' => 'CFGHNBV'
)
);
$app['locale'] = 'en';
include 'ChromePhp.php'; | <?php
$app = array();
$app['config'] = array(
'db' => array(
'dsn' => 'mysql:dbname=foler;host=localhost',
'user' => 'root',
'password' => ''
),
'debug' => false
);
if($app['config']['debug']):
error_reporting(E_ALL);
ini_set('display_errors', 1);
endif;
$ap... |
Add fieldset to config form | <?= $this->form->label(t('Email domain restriction for sign up'), 'registration_email_domain') ?>
<?= $this->form->text('registration_email_domain', $values, $errors, array('placeholder="domain1.tld, domain2.tld, domain3.tld"')) ?>
<p class="form-help"><?= t('Only people with this email address will be allowed to sign ... | <fieldset>
<legend><?= t('Registration') ?></legend>
<?= $this->form->label(t('Email domain restriction for sign up'), 'registration_email_domain') ?>
<?= $this->form->text('registration_email_domain', $values, $errors, array('placeholder="domain1.tld, domain2.tld, domain3.tld"')) ?>
<p class="form-help... |
Modify sample command - add process lock | <?php
namespace Application\MainBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface... | <?php
namespace Application\MainBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface... |
Add test field password with required rule | <?php
namespace Styde\Html\Tests;
use Styde\Html\FormModel\Field;
use Styde\Html\FormModel\FieldCollection;
class FieldCollectionTest extends TestCase
{
/** @test */
function it_adds_a_field()
{
$fields = new FieldCollection(field());
$fields->add('first_name', 'text');
$this->a... | <?php
namespace Styde\Html\Tests;
use Styde\Html\FormModel\Field;
use Styde\Html\FormModel\FieldCollection;
class FieldCollectionTest extends TestCase
{
/** @test */
function it_adds_a_field()
{
$fields = new FieldCollection(field());
$fields->add('first_name', 'text');
$this->a... |
Update to stop it falling too far behind | <?PHP //$Id$
// This file defines the current version of the
// Moodle code that is being used. This can be
// compared against the values stored in the
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
$version = 2003032602; // The current version is a date (YYYYMMDDXX)
$releas... | <?PHP //$Id$
// This file defines the current version of the
// Moodle code that is being used. This can be
// compared against the values stored in the
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
$version = 2003041200; // The current version is a date (YYYYMMDDXX)
$releas... |
Correct wrong constructor in test | <?php
namespace spec\Swarrot\Processor\Stack;
use Swarrot\Processor\InitializableInterface;
use Swarrot\Processor\TerminableInterface;
use Swarrot\Processor\ProcessorInterface;
use Swarrot\ParameterBag;
use Swarrot\AMQP\Message;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class StackedProcessorSpec extends Ob... | <?php
namespace spec\Swarrot\Processor\Stack;
use Swarrot\Processor\InitializableInterface;
use Swarrot\Processor\TerminableInterface;
use Swarrot\Processor\ProcessorInterface;
use Swarrot\ParameterBag;
use Swarrot\AMQP\Message;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class StackedProcessorSpec extends Ob... |
Add missing newline at end of file | <?php
namespace wcf\system\form\builder\field;
/**
* Provides default implementations of `IImmutableFormField` methods.
*
* @author Matthias Schmidt
* @copyright 2001-2018 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Sys... | <?php
namespace wcf\system\form\builder\field;
/**
* Provides default implementations of `IImmutableFormField` methods.
*
* @author Matthias Schmidt
* @copyright 2001-2018 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Sys... |
Fix namespace of Gnupg class in generated phar | <?php
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
// Symfony polyfills must live in global namespace.
$symfonyPolyfill = (static function (): array {
$files = [];
foreach (
Finder::create()
->files()
->in(__DIR__ . '/../../vendor/symfony/polyfill-*')... | <?php
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
// Symfony polyfills must live in global namespace.
$symfonyPolyfill = (static function (): array {
$files = [];
foreach (
Finder::create()
->files()
->in(__DIR__ . '/../../vendor/symfony/polyfill-*')... |
FIX Ignore abstract BuildTasks when loading commands | <?php
namespace SilverLeague\Console\Framework\Loader;
use SilverLeague\Console\Command\Factory;
use SilverLeague\Console\Framework\ConsoleBase;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
/**
* The class responsible for loading/instantiating SilverStrip... | <?php
namespace SilverLeague\Console\Framework\Loader;
use ReflectionClass;
use SilverLeague\Console\Command\Factory;
use SilverLeague\Console\Framework\ConsoleBase;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
/**
* The class responsible for loading/inst... |
Add test for deserializing null body | <?php
declare(strict_types=1);
namespace WoohooLabs\Yin\Tests\JsonApi\Serializer;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use WoohooLabs\Yin\JsonApi\Serializer\JsonDeserializer;
use Zend\Diactoros\ServerRequest;
class JsonDeserializerTest extends TestCase
{
/**
* @test
*/
publ... | <?php
declare(strict_types=1);
namespace WoohooLabs\Yin\Tests\JsonApi\Serializer;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use WoohooLabs\Yin\JsonApi\Serializer\JsonDeserializer;
use Zend\Diactoros\ServerRequest;
class JsonDeserializerTest extends TestCase
{
/**
* @test
*/
publ... |
Add install database to install config | <?php
// Config Generated At: 30-Aug-2016 12:04:23
return [
"installOrder" => [
'Install'
]
];
?>
| <?php
return [
"installOrder" => [
'install',
'install/database'
]
];
?>
|
Fix the HHVM fail as it converts html entities to codes instead of abreviations. | <?php
/**
* This file is part of slick/filter package
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Slick\Tests\Filter;
use PHPUnit_Framework_TestCase as TestCase;
use Slick\Filter\HtmlEntities;
/**
* Html Entities f... | <?php
/**
* This file is part of slick/filter package
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Slick\Tests\Filter;
use PHPUnit_Framework_TestCase as TestCase;
use Slick\Filter\HtmlEntities;
/**
* Html Entities f... |
Fix bug in migration file | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Schema;
class CreateJwtClaimsTable extends Migration
{
/**
* @var string $tableName - Table name.
*/
protected $tableName;
/**
... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Schema;
class CreateJwtClaimsTable extends Migration
{
/**
* @var string $tableName - Table name.
*/
protected $tableName;
/**
... |
Allow controller to hold editor format value. | <?php namespace Orchestra\Story\Routing\Api;
use Illuminate\Routing\Controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\View;
use Orchestra\Story\Facades\StoryFormat;
abstract class EditorController extends Controller {
/**
* Define f... | <?php namespace Orchestra\Story\Routing\Api;
use Illuminate\Routing\Controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Input;
use Orchestra\Support\Facades\Site;
use Orchestra\Story\Facades\StoryFormat;
abstract class EditorController extends Controller {
/**
* Editor fo... |
Fix bug with $errors->has(), presumably introduced with Laravel framework package upgrade | @if (App::environment() !== 'production')
<div class="row">
<div class="col-lg-12">
<div class="alert alert-warning">
<p><strong>Note:</strong> This installation of OpenDominion is running on
<b>{{ App::environment() }}</b> environment and is not meant for pro... | @if (App::environment() !== 'production')
<div class="row">
<div class="col-lg-12">
<div class="alert alert-warning">
<p><strong>Note:</strong> This installation of OpenDominion is running on
<b>{{ App::environment() }}</b> environment and is not meant for pro... |
Add note that staff knows the password | <div class="pure-g centered-row">
<div class="pure-u-1 pure-u-md-1-2">
<div class="l-box">
<p> <?php echo _('If you do not want to check in, you can still use the access code!') ; ?> <p>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2">
<d... | <div class="pure-g centered-row">
<div class="pure-u-1 pure-u-md-1-2">
<div class="l-box">
<p> <?php echo _('If you do not want to check in, you can still use the access code!') ; ?> <p>
<p> <?php echo _('Just ask our staff about the Wi-Fi.') ; ?> <p>
... |
Check empty image + missing alt attribute. | <li class="event-list-item">
<a class="event-list-item-link" href="{{ $event->uri() }}">
<div class="event-list-item-image-wrapper">
<img class="event-list-item-image" src="{{ $event->present()->image(540, 400) }}" width="{{ $event->image->width }}" height="{{ $event->image->height }}" alt="">
... | <li class="event-list-item">
<a class="event-list-item-link" href="{{ $event->uri() }}">
<div class="event-list-item-image-wrapper">
@empty (!$event->image)
<img class="event-list-item-image" src="{{ $event->present()->image(540, 400) }}" width="{{ $event->image->width }}" height="{{... |
FIX Use correct mock assertion methods for PHPUnit 3.7 | <?php
namespace BringYourOwnIdeas\Maintenance\Tests\Tasks;
use BringYourOwnIdeas\Maintenance\Util\ComposerLoader;
use SapphireTest;
use BringYourOwnIdeas\Maintenance\Tasks\UpdatePackageInfo;
class UpdatePackageInfoTest extends SapphireTest
{
public function testGetPackageInfo()
{
$loader = $this->get... | <?php
namespace BringYourOwnIdeas\Maintenance\Tests\Tasks;
use BringYourOwnIdeas\Maintenance\Util\ComposerLoader;
use SapphireTest;
use BringYourOwnIdeas\Maintenance\Tasks\UpdatePackageInfo;
class UpdatePackageInfoTest extends SapphireTest
{
public function testGetPackageInfo()
{
$loader = $this->get... |
Remove some unecessary @property doc comments | <?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
/**
* @property Expr $var Variable
* @property Expr $expr Expression
*/
abstract class AssignOp extends Expr
{
/** @var Expr Variable */
public $var;
/** @var Expr Expression */
public $expr;
/**
* Constructs a compound assig... | <?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
abstract class AssignOp extends Expr
{
/** @var Expr Variable */
public $var;
/** @var Expr Expression */
public $expr;
/**
* Constructs a compound assignment operation node.
*
* @param Expr $var Variable
*... |
Revert "$this->app->share deprecated in 5.4" | <?php namespace Cornford\Bootstrapper;
use Illuminate\Support\ServiceProvider;
class BootstrapServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Bootstrap the application events.
*
* @return void
*/
pu... | <?php namespace Cornford\Bootstrapper;
use Illuminate\Support\ServiceProvider;
class BootstrapServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Bootstrap the application events.
*
* @return void
*/
pu... |
Speed up DOI extraction with new regexp | <?php
namespace Altmetric\Identifiers;
class Doi
{
const REGEXP = <<<'EOT'
{
10 # Directory indicator (always 10)
\.
(?:
# ISBN-A
97[89]\. # ISBN (GS1) Bookland prefix
\d{2,8} # ISBN registration group element and publisher prefix
/ # Prefix/suffix divider
... | <?php
namespace Altmetric\Identifiers;
class Doi
{
const REGEXP = <<<'EOT'
{
10 # Directory indicator (always 10)
\.
(?:
# ISBN-A
97[89]\. # ISBN (GS1) Bookland prefix
\d{2,8} # ISBN registration group element and publisher prefix
... |
Change misleading PromotionCouponRepository method name | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Promotion\Repository;
use Doctrine\ORM\QueryBuil... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Promotion\Repository;
use Doctrine\ORM\QueryBuil... |
Update user model with facebook_id | <?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 Mo... | <?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 Mo... |
Change addError() and resetErrors() return type to void | <?php
declare(strict_types=1);
namespace Brick\Form;
/**
* Base class for Form & Component.
*/
abstract class Base
{
/**
* @var string[]
*/
private $errors = [];
/**
* @param string $errorMessage
*
* @return static
*/
public function addError(string $errorMessage) : B... | <?php
declare(strict_types=1);
namespace Brick\Form;
/**
* Base class for Form & Component.
*/
abstract class Base
{
/**
* @var string[]
*/
private $errors = [];
/**
* @param string $errorMessage
*
* @return void
*/
public function addError(string $errorMessage) : voi... |
Handle array of values for the MAC. | <?php
namespace MCordingley\LaravelSapient\Middleware;
use Closure;
use Illuminate\Http\Request;
use MCordingley\LaravelSapient\Contracts\KeyResolver;
use ParagonIE\ConstantTime\Base64UrlSafe;
use ParagonIE\Sapient\CryptographyKeys\SigningPublicKey;
use Symfony\Component\HttpFoundation\Response;
final class VerifyRe... | <?php
namespace MCordingley\LaravelSapient\Middleware;
use Closure;
use Illuminate\Http\Request;
use MCordingley\LaravelSapient\Contracts\KeyResolver;
use ParagonIE\ConstantTime\Base64UrlSafe;
use ParagonIE\Sapient\CryptographyKeys\SigningPublicKey;
use Symfony\Component\HttpFoundation\Response;
final class VerifyRe... |
Remove String annotations, use Field instead | <?php
namespace Saxulum\Tests\DoctrineMongoDbOdm\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document
*/
class Page
{
/**
* @var string
* @ODM\Id
*/
protected $id;
/**
* @var string
* @ODM\String
*/
protected $title;
/**
* @var ... | <?php
namespace Saxulum\Tests\DoctrineMongoDbOdm\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document
*/
class Page
{
/**
* @var string
* @ODM\Id
*/
protected $id;
/**
* @var string
* @ODM\Field(type="string")
*/
protected $title;
/*... |
Add Change to End Of Array | <?php
$Reference = [
['Titre' => 'Telephone1', 'Description' => 'BlaBla1', 'Image' => '', 'Texte' => 'Texte1'];
['Titre' => 'Telephone2', 'Description' => 'BlaBla2', 'Image' => '', 'Texte' => 'Texte2'];
['Titre' => 'Telephone3', 'Description' => 'BlaBla3', 'Image' => '', 'Texte' => 'Texte3'];
];
?>
| <?php
$Reference = [
['Titre' => 'Telephone1', 'Description' => 'BlaBla1', 'Image' => '', 'Texte' => 'Texte1'],
['Titre' => 'Telephone2', 'Description' => 'BlaBla2', 'Image' => '', 'Texte' => 'Texte2'],
['Titre' => 'Telephone3', 'Description' => 'BlaBla3', 'Image' => '', 'Texte' => 'Texte3'],
];
?>
|
Add docblock to add method | <?php namespace Philipbrown\Math;
class Math {
public function add($a, $b, $scale = 0)
{
return bcadd($a, $b, $scale);
}
}
| <?php namespace Philipbrown\Math;
class Math {
/**
* Add
*
* @param string $a
* @param string $a
* @param integer $scale
* @return string
*/
public function add($a, $b, $scale = 0)
{
return bcadd($a, $b, $scale);
}
}
|
Insert into 'entries' using prepared statements, with submission ID | <?php
$date =& $_REQUEST["date"];
$user =& $_REQUEST["user"];
$priority =& $_REQUEST["priority"];
$text =& $_REQUEST["text"];
require_once 'icat.php';
$db = init_db();
$_SESSION['entry_username'] = $user;
$result = mysqli_query($db,
"insert into entries (contest_time, user, prio... | <?php
$date =& $_REQUEST["date"];
$user =& $_REQUEST["user"];
$priority =& $_REQUEST["priority"];
$text =& $_REQUEST["text"];
if (isset($_REQUEST["submission"])) {
$sid = intval($_REQUEST["submission"]);
} else {
$sid = null;
}
require_once 'icat.php';
$db = init... |
Change Proxy class used to Doctrine\Common\Persistence\Proxy | <?php
/*
* Copyright 2013 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless re... | <?php
/*
* Copyright 2013 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless re... |
Add missing phpdoc and improve assertion error messages | <?php
namespace Imbo\Plugin\MetadataCache\Cache;
use PHPUnit_Framework_TestCase;
abstract class CacheTests extends PHPUnit_Framework_TestCase {
/**
* @var CacheInterface
*/
private $adpter;
abstract protected function getAdapter();
public function setUp() {
$this->adapter = $this->... | <?php
namespace Imbo\Plugin\MetadataCache\Cache;
use PHPUnit_Framework_TestCase;
use stdClass;
abstract class CacheTests extends PHPUnit_Framework_TestCase {
/**
* @var CacheInterface
*/
private $adpter;
/**
* Get the adapter to test
*
* @return CacheInterface
*/
abstrac... |
Set a created_at date before saving a new request | <?php
class Meanbee_ShoppingAssistant_Model_Resource_Request extends Mage_Core_Model_Resource_Db_Abstract
{
public function _construct()
{
$this->_init("meanbee_shoppingassistant/request", "entity_id");
}
}
| <?php
class Meanbee_ShoppingAssistant_Model_Resource_Request extends Mage_Core_Model_Resource_Db_Abstract
{
public function _construct()
{
$this->_init("meanbee_shoppingassistant/request", "entity_id");
}
protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
{
if... |
Add a new line to a file to conform with tht formatting styles | <?php
use Hubzero\Content\Migration\Base;
// No direct access
defined('_HZEXEC_') or die();
/**
* Migration script for adding offering_id to notes
**/
class Migration20170815000001ComPublications extends Base
{
/**
* Up
**/
public function up()
{
if (!$this->db->tableHasField('#__publications', 'featured'... | <?php
use Hubzero\Content\Migration\Base;
// No direct access
defined('_HZEXEC_') or die();
/**
* Migration script for adding offering_id to notes
**/
class Migration20170815000001ComPublications extends Base
{
/**
* Up
**/
public function up()
{
if (!$this->db->tableHasField('#__publications', 'featured'... |
Add token value based cart context | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Order\Repository;
use Doctrine\ORM\QueryBuilder;... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Order\Repository;
use Doctrine\ORM\QueryBuilder;... |
Add template var for model generation | <?php namespace Way\Generators\Commands;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ModelGeneratorCommand extends GeneratorCommand {
/**
* The console command name.
*
* @var string
*/
protected $name = 'generate:model';
/... | <?php namespace Way\Generators\Commands;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ModelGeneratorCommand extends GeneratorCommand {
/**
* The console command name.
*
* @var string
*/
protected $name = 'generate:model';
/... |
Fix navbar outside html tags | @extends('main')
@section('head')
<style>
.row
{
margin-top: 5%;
}
#meme
{
display: block;
margin-left: auto;
margin-right: auto;
}
#progress
{
margin-top: 1%;
}
</style>
@endsect... | @extends('main')
@section('head')
<style>
.row
{
margin-top: 5%;
}
#meme
{
display: block;
margin-left: auto;
margin-right: auto;
}
#progress
{
margin-top: 1%;
}
</style>
@endsect... |
Change wp_trim_excerpt to excerpt_more and update return. | <?php
/**
* Load admin dependencies.
*/
$tempdir = get_template_directory();
require_once($tempdir.'/admin/init.php');
/**
* Theme set up settings.
*/
add_action('after_setup_theme', function()
{
// Configure WP 2.9+ Thumbnails.
add_theme_support('post-thumbnails');
set_post_thumbnail_size(50, 50, true);
add_... | <?php
/**
* Load admin dependencies.
*/
$tempdir = get_template_directory();
require_once($tempdir.'/admin/init.php');
/**
* Theme set up settings.
*/
add_action('after_setup_theme', function()
{
// Configure WP 2.9+ Thumbnails.
add_theme_support('post-thumbnails');
set_post_thumbnail_size(50, 50, true);
add_... |
Add job id as foreign key to applications table | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApplicationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('applicatio... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApplicationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('applicatio... |
Fix broken newsflow on launch | <?
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php', array('enableEditing' => true));
?>
<div class="ccm-ui">
<div class="newsflow" id="newsflow-main">
<? $this->inc('elements/header_newsflow.php'); ?>
<table class="newsflow-layout">
<tr>
<td class="newsflow-em1" style="width: 66%" co... | <?
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php', array('enableEditing' => true));
?>
<div class="ccm-ui">
<div class="newsflow" id="newsflow-main">
<? $this->inc('elements/header_newsflow.php'); ?>
<table class="newsflow-layout">
<tr>
<td class="newsflow-em1" style="width: 66%" ro... |
Use class level method definition to re-define method return type | <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license an... | <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license an... |
Test facade and container instance | <?php
namespace Jgustavo99\Gerencianet\Tests;
use Jgustavo99\Gerencianet\Tests\AbstractTestCase;
class FacadeTest extends AbstractTestCase
{
public function test_facade_instance () {
$this->assertInstanceOf('Gerencianet\Gerencianet', app('Gerencianet'));
}
} | <?php
namespace Jgustavo99\Gerencianet\Tests;
use Jgustavo99\Gerencianet\Facades\Gerencianet;
use Jgustavo99\Gerencianet\Tests\AbstractTestCase;
class FacadeTest extends AbstractTestCase
{
public function test_container_instance () {
$this->assertInstanceOf('Gerencianet\Gerencianet', app('Gerencianet'));... |
Rectify Msession Model and specify pivot table name -bergynj | <?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Msessions extends Model {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'msessions';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['session_time','cine... | <?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Msessions extends Model {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'msessions';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['session_time','cine... |
Add yield for scripts in footer | <script src="{{ elixir('js/app.js') }}"></script>
</body>
</html> | <script src="{{ elixir('js/app.js') }}"></script>
@yield("scripts")
</body>
</html> |
Check returned value of non-stubbed method call | <?php
namespace spec\rtens\mockster3;
use rtens\mockster3\Mockster;
use watoki\scrut\Specification;
class CheckReturnTypeTest extends Specification {
/** @var CheckReturnTypeTest_FooClass $mock */
private $mock;
/** @var CheckReturnTypeTest_FooClass|Mockster $foo */
private $foo;
protected func... | <?php
namespace spec\rtens\mockster3;
use rtens\mockster3\Mockster;
use watoki\scrut\Specification;
class CheckReturnTypeTest extends Specification {
/** @var CheckReturnTypeTest_FooClass $mock */
private $mock;
/** @var CheckReturnTypeTest_FooClass|Mockster $foo */
private $foo;
protected func... |
Use ctype_digit to validate port | <?php
/**
* This file is part of the League.url library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/url/
* @version 4.0.0
* @package League.url
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
na... | <?php
/**
* This file is part of the League.url library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/url/
* @version 4.0.0
* @package League.url
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
na... |
Move common mapper task into base. | <?php
/**
* User: wangting
* Date: 12-11-29
* Time: 上午11:56
* copyright 2012 tiddr.de
*/
class Base
{
}
| <?php
namespace Tiddr\Mapper;
use ZfcBase\Mapper\AbstractDbMapper;
use Zend\Db\ResultSet\HydratingResultSet;
use Zend\Paginator\Paginator;
use Zend\Paginator\Adapter\DbSelect;
/**
* User: wangting
* Date: 12-11-29
* Time: 上午11:56
* copyright 2012 tiddr.de
*/
class Base extends AbstractDbMapper
{
public funct... |
Fix update version for 0.9.2 -> 0.9.3 | <?php
return array(
'0.8.0' => '0.8.1',
'0.8.1' => '0.8.2',
'0.9.0' => '0.9.2',
'0.9.1' => '0.9.2',
'0.8-dev' => 'dev',
'0.10-dev' => 'dev',
);
| <?php
return array(
'0.8.0' => '0.8.1',
'0.8.1' => '0.8.2', // not exist yet
'0.9.0' => '0.9.2',
'0.9.1' => '0.9.2',
'0.9.2' => '0.9.3', // not exist yet
'0.8-dev' => 'dev',
'0.10-dev' => 'dev',
);
|
Include the site root in the URL | <?php
class Plugin_download extends Plugin
{
public function index()
{
$file = $this->fetchParam(array('file', 'filename', 'url'), null, null, false, false);
$as = $this->fetchParam('as', null, null, false, false);
$url = '/TRIGGER/download/download?file='.$file;
if ($as) {
$url .= '&as='.$as;
}
r... | <?php
class Plugin_download extends Plugin
{
public function index()
{
$file = $this->fetchParam(array('file', 'filename', 'url'), null, null, false, false);
$as = $this->fetchParam('as', null, null, false, false);
$url = URL::prependSiteRoot('/TRIGGER/download/download?file='.$file);
if ($as) {
$u... |
Change default welcome page to include menu | <!DOCTYPE html>
<html>
<head>
<title>Laravel</title>
<link href="//fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding... | <!DOCTYPE html>
<html>
<head>
<title>Laravel</title>
<link href="//fonts.googleapis.com/css?family=Lato:300" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding... |
Use processConfiguration() instead of process() | <?php
namespace Beanstalkapp\BeanstalkAPI\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Comp... | <?php
namespace Beanstalkapp\BeanstalkAPI\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Comp... |
Add bounds to the package name regex | <?php
namespace Packagist\WebBundle\Twig;
use Symfony\Bridge\Doctrine\RegistryInterface;
class PackagistExtension extends \Twig_Extension
{
/**
* @var \Symfony\Bridge\Doctrine\RegistryInterface
*/
private $doctrine;
public function __construct(RegistryInterface $doctrine)
{
$this->... | <?php
namespace Packagist\WebBundle\Twig;
use Symfony\Bridge\Doctrine\RegistryInterface;
class PackagistExtension extends \Twig_Extension
{
/**
* @var \Symfony\Bridge\Doctrine\RegistryInterface
*/
private $doctrine;
public function __construct(RegistryInterface $doctrine)
{
$this->... |
Make sure to run realpath on $file | <?php
namespace Avalanche\Bundle\ImagineBundle\Imagine;
use Avalanche\Bundle\ImagineBundle\Imagine\Filter\FilterManager;
class CacheReloader
{
private $sourceRoot;
private $cacheManager;
private $filterManager;
public function __construct($sourceRoot, CacheManager $cacheManager, FilterManager $filte... | <?php
namespace Avalanche\Bundle\ImagineBundle\Imagine;
use Avalanche\Bundle\ImagineBundle\Imagine\Filter\FilterManager;
class CacheReloader
{
private $sourceRoot;
private $cacheManager;
private $filterManager;
public function __construct($sourceRoot, CacheManager $cacheManager, FilterManager $filte... |
Make email field optional when creating reservation as an admin | <?php
namespace Admin\Requests;
use System\Classes\FormRequest;
class Reservation extends FormRequest
{
protected function useDataFrom()
{
return static::DATA_TYPE_POST;
}
public function rules()
{
return [
['location_id', 'admin::lang.reservations.text_restaurant', '... | <?php
namespace Admin\Requests;
use System\Classes\FormRequest;
class Reservation extends FormRequest
{
protected function useDataFrom()
{
return static::DATA_TYPE_POST;
}
public function rules()
{
return [
['location_id', 'admin::lang.reservations.text_restaurant', '... |
Adjust test to be specific to mbc-logging-processor | <?php
use DoSomething\MBC_LoggingGateway\MBC_LoggingGateway;
// Including that file will also return the autoloader instance, so you can store
// the return value of the include call in a variable and add more namespaces.
// This can be useful for autoloading classes in a test suite, for example.
// https://g... | <?php
use DoSomething\MBC_LoggingGateway\MBC_LoggingGateway;
// Including that file will also return the autoloader instance, so you can store
// the return value of the include call in a variable and add more namespaces.
// This can be useful for autoloading classes in a test suite, for example.
// https://g... |
Fix bug by adding JWTAuthServiceProvider declaration back to the file | <?php
namespace WWON\JwtGuard\Providers;
use Illuminate\Support\Facades\Auth;
use WWON\JwtGuard\Contract\TokenManager as TokenManagerContract;
use WWON\JwtGuard\JwtGuard;
class JwtGuardServiceProvider extends JWTAuthServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var... | <?php
namespace WWON\JwtGuard\Providers;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Providers\JWTAuthServiceProvider;
use WWON\JwtGuard\Contract\TokenManager as TokenManagerContract;
use WWON\JwtGuard\JwtGuard;
class JwtGuardServiceProvider extends JWTAuthServiceProvider
{
/**
* Indicates if loa... |
Allow admins to access Horizon | <?php
namespace App\Providers;
use App\Models\Reply;
use App\Models\Thread;
use App\User;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Laravel\Horizon\Horizon;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
$this->bootEl... | <?php
namespace App\Providers;
use App\Models\Reply;
use App\Models\Thread;
use App\User;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Laravel\Horizon\Horizon;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
$this->bootEl... |
Test getStop() and print out data | #!/usr/bin/php -q
<?php
require_once('../lib/SiriClient.php');
$c=new SiriClient('http://data.foli.fi/siri/');
$c->loadStops();
$c->loadStop(1170);
$vmr=$c->loadVehicles();
if ($vmr===SiriClient::VM_PENDING)
echo "VM data is pending\n";
?>
| #!/usr/bin/php -q
<?php
require_once('../lib/SiriClient.php');
$c=new SiriClient('http://data.foli.fi/siri/');
$c->loadStops();
$c->loadStop("1170");
$data=$c->getStop("1170");
print_r($data);
$vmr=$c->loadVehicles();
if ($vmr===SiriClient::VM_PENDING)
echo "VM data is pending\n";
?>
|
Put declare() statement on newline | <?php declare(strict_types=1);
namespace CultuurNet\UDB3\Organizer\Events;
use CultuurNet\Geocoding\Coordinate\Coordinates;
use CultuurNet\Geocoding\Coordinate\Latitude;
use CultuurNet\Geocoding\Coordinate\Longitude;
final class GeoCoordinatesUpdated extends OrganizerEvent
{
/**
* @var Coordinates
*/
... | <?php
declare(strict_types=1);
namespace CultuurNet\UDB3\Organizer\Events;
use CultuurNet\Geocoding\Coordinate\Coordinates;
use CultuurNet\Geocoding\Coordinate\Latitude;
use CultuurNet\Geocoding\Coordinate\Longitude;
final class GeoCoordinatesUpdated extends OrganizerEvent
{
/**
* @var Coordinates
*/
... |
Improve error to load module assets. | <?php echo Asset::css('site.css');?>
<?php
$module_assets_css = conf('assets.css.modules');
foreach ($module_assets_css as $module => $files)
{
if ($module == 'admin') continue;
foreach ($files as $file) echo Asset::css(sprintf('modules/%s/%s', $module, $file));
}
?>
| <?php echo Asset::css('site.css');?>
<?php
$module_assets_css = conf('assets.css.modules', null, array());
foreach ($module_assets_css as $module => $files)
{
if ($module == 'admin') continue;
foreach ($files as $file) echo Asset::css(sprintf('modules/%s/%s', $module, $file));
}
?>
|
Add new test for fromHttpResponse method. | <?php
use OAuth1Client\Credentials\TemporaryCredentials;
class TemporaryCredentialsTest extends PHPUnit_Framework_TestCase {
protected $temporaryCredentials;
function setUp()
{
$this->temporaryCredentials = new TemporaryCredentials('foo', 'bar');
}
/** @test */
function temporary_cre... | <?php
use GuzzleHttp\Client as HttpClient;
use OAuth1Client\Credentials\TemporaryCredentials;
class TemporaryCredentialsTest extends PHPUnit_Framework_TestCase {
protected $temporaryCredentials;
function setUp()
{
$this->temporaryCredentials = new TemporaryCredentials('foo', 'bar');
$thi... |
Add function for getting all organisms | <?php
namespace ajax\listing;
use \PDO as PDO;
/**
* Web Service.
* Returns Organisms with given ids
*/
class Organisms extends \WebService {
/**
* @param $querydata[ids] array of organism ids
* @returns array of organisms
*/
public function execute($querydata) {
global $db;
... | <?php
namespace ajax\listing;
use \PDO as PDO;
/**
* Web Service.
* Returns Organisms with given ids
*/
class Organisms extends \WebService {
/**
* @param $querydata[ids] array of organism ids
* @returns array of organisms
*/
public function execute($querydata) {
global $db;
... |
Fix for Nelmio API Doc | <?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzTimestampTypeBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Bukashk0zzz\TimestampTypeBun... | <?php declare(strict_types = 1);
/*
* This file is part of the Bukashk0zzzTimestampTypeBundle
*
* (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Bukashk0zzz\TimestampTypeBun... |
Set primary key and adjust types | <?php
declare(strict_types=1);
namespace OCA\B2shareBridge\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version010100Date20200130114400 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `... | <?php
declare(strict_types=1);
namespace OCA\B2shareBridge\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version010100Date20200130114400 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `... |
Reformat in line with coding standards. | <?php
namespace Gothick\AkismetClient;
class Exception extends \Exception
{
public function __construct($message, $code = 0, \Exception $previous = null)
{
parent::__construct('Gothick\AkismetClient: ' . $message, $code, $previous);
}
} | <?php
namespace Gothick\AkismetClient;
class Exception extends \Exception
{
public function __construct ($message, $code = 0, \Exception $previous = null)
{
parent::__construct('Gothick\AkismetClient: ' . $message, $code,
$previous);
}
} |
Set updated and created fields in migration | <?php
use Migrations\AbstractMigration;
class AddAttachmentType extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
* @return void
*/
public function up()
{
... | <?php
use Migrations\AbstractMigration;
class AddAttachmentType extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
* @return void
*/
public function up()
{
... |
Fix tests of router console | <?php
declare(strict_types=1);
use Composer\Autoload\ClassLoader;
if (!class_exists('ComposerMock', false)) {
class ComposerMock extends ClassLoader
{
public function getPrefixesPsr4()
{
return [
'App\\' => [dirname(__DIR__)],
];
}
}
}
retu... | <?php
declare(strict_types=1);
use Composer\Autoload\ClassLoader;
if (!class_exists('ComposerMock', false)) {
class ComposerMock extends ClassLoader
{
public function getPrefixesPsr4()
{
return [
'App\\' => [dirname(__DIR__)],
'Common\\' => [dirname... |
Fix error on PHP >= 5.5 | <?php
namespace PhpToZephir\CodeCollector;
class DirectoryCodeCollector implements CodeCollectorInterface
{
/**
* @var array
*/
private $directories;
/**
* @param array $code
*/
public function __construct(array $directories)
{
$this->directories = $directories;
}
/**
* @param string $dir
* @... | <?php
namespace PhpToZephir\CodeCollector;
class DirectoryCodeCollector implements CodeCollectorInterface
{
/**
* @var array
*/
private $directories;
/**
* @param array $code
*/
public function __construct(array $directories)
{
$this->directories = $directories;
}
/**
* @param string $dir
* @... |
Make EOF LineFeed run last | <?php
/*
* This file is part of the PHP CS utility.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\CS\Fixer;
use Symfony\CS\FixerInterface;
/**
* @author Fabien Potencier <fabi... | <?php
/*
* This file is part of the PHP CS utility.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\CS\Fixer;
use Symfony\CS\FixerInterface;
/**
* @author Fabien Potencier <fabi... |
Update the main database seeder class | <?php
/*
* This file is part of Bens Penhorados, an undergraduate capstone project.
*
* (c) Fábio Santos <ffsantos92@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Eloquent\Model;
use Illuminat... | <?php
/*
* This file is part of Bens Penhorados, an undergraduate capstone project.
*
* (c) Fábio Santos <ffsantos92@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Eloquent\Model;
use Illuminat... |
Add return to method (corrected typo) | <?php
namespace Coreplex\Meta\Eloquent;
use Coreplex\Meta\Contracts\Variant;
trait HasMetaData
{
/**
* Retrieve the meta data for this model
*
* @param Variant $variant
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
*/
public function meta(Variant $variant = null)
{
... | <?php
namespace Coreplex\Meta\Eloquent;
use Coreplex\Meta\Contracts\Variant;
trait HasMetaData
{
/**
* Retrieve the meta data for this model
*
* @param Variant $variant
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
*/
public function meta(Variant $variant = null)
{
... |
Change column to `integer` to match `artist_tracks` table spec | <?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Ad... | <?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Ad... |
Allow easier testing of light vs dark. | <?php
namespace Blog\Site;
use ScriptHelper\ScriptInclude;
use Psr\Http\Message\ServerRequestInterface as ServerRequest;
class ThemeCSS
{
private $scriptInclude;
private $serverRequest;
public function __construct(ScriptInclude $scriptInclude, ServerRequest $serverRequest)
{
$this->scri... | <?php
namespace Blog\Site;
use ScriptHelper\ScriptInclude;
use Psr\Http\Message\ServerRequestInterface as ServerRequest;
class ThemeCSS
{
private $scriptInclude;
private $serverRequest;
public function __construct(ScriptInclude $scriptInclude, ServerRequest $serverRequest)
{
$this->scri... |
Declare exceptions that are already thrown by implementations | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Encoder;
/**
* PasswordEncoderInterfac... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Encoder;
use Symfony\Component\Security... |
Add @method annotations for cron entity | <?php
namespace Bolt\Storage\Entity;
/**
* Entity for cron jobs.
*/
class Cron extends Entity
{
protected $id;
protected $lastrun;
protected $interim;
}
| <?php
namespace Bolt\Storage\Entity;
/**
* Entity for cron jobs.
*
* @method integer getId()
* @method string getInterim()
* @method \DateTime getLastrun()
* @method setId($id)
* @method setInterim($interim)
* @method setLastrun($lastrun)
*/
class Cron extends Entity
{
protected $id;
protected $i... |
Convert HTTP redirect to 301 Moved Permanently | <?php
/* Redirect to HTTPS and refuse to serve HTTP */
if($_SERVER['HTTPS'] != "on"){
$_SERVER['FULL_URL'] = 'https://';
if($_SERVER['SERVER_PORT']!='80')
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'... | <?php
/* Redirect to HTTPS and refuse to serve HTTP */
if($_SERVER['HTTPS'] != "on"){
$_SERVER['FULL_URL'] = 'https://';
if($_SERVER['SERVER_PORT']!='80')
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'... |
Extend validator with VAT number validation. | <?php
namespace DvK\Laravel\Vat;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
class VatServiceProvider extends ServiceProvider
{
/**
* Boot the service provider.
*
* @return void
*/
public function boot()
{
//
}
/**
* Regi... | <?php
namespace DvK\Laravel\Vat;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator as RequestValidator;
class VatServiceProvider extends ServiceProvider
{
/**
* Boot the service provider.
*
* @return void
*/
publ... |
Add more helpful error message | <?php
namespace PivotLibre\Tideman;
use \InvalidArgumentException;
class MarginRegistry
{
private $registry = array();
protected function makeKey(Candidate $winner, Candidate $loser) : string
{
$winnerId = $winner->getId();
$loserId = $loser->getId();
$key = $winnerId . $loserId;
... | <?php
namespace PivotLibre\Tideman;
use \InvalidArgumentException;
class MarginRegistry
{
private $registry = array();
protected function makeKey(Candidate $winner, Candidate $loser) : string
{
$winnerId = $winner->getId();
$loserId = $loser->getId();
$key = $winnerId . $loserId;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.