Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Support non-zero-indexed arrays in ensure(). Improve phrasing of Exception messages | <?php
namespace Kaloa\Util\TypeSafety;
use IllegalArgumentException;
trait TypeSafetyTrait
{
/**
* @param string $types
* @param array $args
*/
private function ensure($types, array $args)
{
if (!is_string($types)) {
throw new IllegalArgumentException('string expected')... | <?php
namespace Kaloa\Util\TypeSafety;
use IllegalArgumentException;
trait TypeSafetyTrait
{
/**
* @param string $types
* @param array $args
*/
private function ensure($types, array $args)
{
if (!is_string($types)) {
throw new IllegalArgumentException('Type list must be... |
Return $this after adding a tag | <?php
namespace SlmMail\Mail\Message\Provider;
use SlmMail\Mail\Message\ProvidesOptions;
use SlmMail\Mail\Message\ProvidesTags;
use Zend\Mail\Message;
class Mailgun extends Message
{
use ProvidesOptions;
const TAG_LIMIT = 3;
/**
* @var array
*/
protected $tags = array();
/**
* G... | <?php
namespace SlmMail\Mail\Message\Provider;
use SlmMail\Mail\Message\ProvidesOptions;
use SlmMail\Mail\Message\ProvidesTags;
use Zend\Mail\Message;
class Mailgun extends Message
{
use ProvidesOptions;
const TAG_LIMIT = 3;
/**
* @var array
*/
protected $tags = array();
/**
* G... |
Add route to just authenticate user | <?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond ... | <?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond ... |
Fix - in cli mode PROJECT_ROOT was not empty when script was run not from project. | <?
define('E_REPORTING', E_ALL & ~E_NOTICE);
error_reporting(E_REPORTING);
ini_set('display_errors', 'On');
define('TIME_START', microtime(true));
define('ROOT', dirname(dirname(__FILE__)));
define('CONFIG_ROOT', dirname(dirname(dirname(__FILE__))).'/config');
define('PROJECT', strtolower(isset($_ENV["PROJECT"]) ? $_EN... | <?
define('E_REPORTING', E_ALL & ~E_NOTICE);
error_reporting(E_REPORTING);
ini_set('display_errors', 'On');
define('TIME_START', microtime(true));
define('ROOT', dirname(dirname(__FILE__)));
define('CONFIG_ROOT', dirname(dirname(dirname(__FILE__))).'/config');
define('PROJECT', strtolower(isset($_ENV["PROJECT"]) ? $_EN... |
Use namespaced Twig class and interface | <?php
namespace Shivas\VersioningBundle\Twig;
use Shivas\VersioningBundle\Service\VersionManager;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
/**
* Class VersionExtension
*/
class VersionExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
/**
* @var VersionManager
... | <?php
namespace Shivas\VersioningBundle\Twig;
use Shivas\VersioningBundle\Service\VersionManager;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;
/**
* Class VersionExtension
*/
class VersionExtension extends AbstractExtension implements GlobalsInterface
{
/**
* @var VersionMana... |
Disable translatable fallback locale in admin | <?php
namespace TypiCMS\Modules\Core\Http\Middleware;
use Closure;
class SetTranslatableFallbackLocaleToNull
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(... | <?php
namespace TypiCMS\Modules\Core\Http\Middleware;
use Closure;
class SetTranslatableFallbackLocaleToNull
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(... |
Refactor Polynomial unit test and add more test cases. | <?php
namespace Math\Functions;
class PolynomialTest extends \PHPUnit_Framework_TestCase
{
public function testString()
{
// p(x) = x² + 2x + 3
$polynomial = new Polynomial([1, 2, 3]);
$expected = " x² + 2x + 3";
$actual = strval($polynomial);
$this->assertEquals($expe... | <?php
namespace Math\Functions;
class PolynomialTest extends \PHPUnit_Framework_TestCase
{
public function testString()
{
// p(x) = x² + 2x + 3
$polynomial = new Polynomial([1, 2, 3]);
$expected = " x² + 2x + 3";
$actual = strval($polynomial);
$this->assertEquals($expe... |
Add annotations for exception methods | <?php
namespace GuzzleHttp\Exception;
interface GuzzleException {}
| <?php
namespace GuzzleHttp\Exception;
/**
* @method string getMessage()
* @method \Throwable|null getPrevious()
* @method mixed getCode()
* @method string getFile()
* @method int getLine()
* @method array getTrace()
* @method string getTraceAsString()
*/
interface GuzzleException {}
|
Add js resize script to header. | <?php session_start(); ?>
<!DOCTYPE html>
<head>
<title>ClinicCases - Online Case Management Software for Law School Clinics</title>
<meta name="robots" content="noindex">
<link rel="stylesheet" href="html/css/cm.css" type="text/css">
<link rel="stylesheet" href="html/css/cm_tabs.css" type="text/css">
<link rel="... | <?php session_start(); ?>
<!DOCTYPE html>
<head>
<title>ClinicCases - Online Case Management Software for Law School Clinics</title>
<meta name="robots" content="noindex">
<link rel="stylesheet" href="html/css/cm.css" type="text/css">
<link rel="stylesheet" href="html/css/cm_tabs.css" type="text/css">
<link rel="... |
Fix input image for form builder | <label class="col-sm-2 control-label">{{ $input['label'] }}</label>
<div class="col-sm-10">
@if ($value)
{{ HTML::image($file_url.'/'.$name.'/'.$value, '', ['class' => 'uploaded_image']) }}
@endif
{{ Form::file($name, ['class' => 'form-control']) }}
<p class="help-block">
Изображение будет {{ trans('image.meth... | <label class="col-sm-2 control-label">{{ $input['label'] }}</label>
<div class="col-sm-10">
@if ($value)
{{ HTML::image($file_url.'/'.$name.'/'.$value, '', ['class' => 'uploaded_image']) }}
@endif
{{ Form::file($name, ['class' => 'form-control']) }}
<p class="help-block">
Изображение будет {{ trans('image.meth... |
Fix for msg "Api validation failed" on first time save | <?php
namespace Dotdigitalgroup\Email\Model\Apiconnector;
class Test
{
/**
* @var \Dotdigitalgroup\Email\Helper\Data
*/
public $helper;
/**
* Test constructor.
*
* @param \Dotdigitalgroup\Email\Helper\Data $data
*/
public function __construct(
\Dotdigitalgroup\Em... | <?php
namespace Dotdigitalgroup\Email\Model\Apiconnector;
class Test
{
/**
* @var \Dotdigitalgroup\Email\Helper\Data
*/
public $helper;
/**
* @var \Magento\Framework\App\Config\ReinitableConfigInterface
*/
public $config;
/**
* Test constructor.
*
* @param \Dotd... |
Make mdb2 reference actually read-only. | <?php
require_once 'Site/SiteApplicationModule.php';
require_once 'SwatDB/exceptions/SwatDBException.php';
require_once 'MDB2.php';
/**
* Application module for database connectivity
*
* @package Site
* @copyright 2004-2006 silverorange
*/
class SiteDatabaseModule extends SiteApplicationModule
{
// {{{ pub... | <?php
require_once 'Site/SiteApplicationModule.php';
require_once 'SwatDB/exceptions/SwatDBException.php';
require_once 'MDB2.php';
/**
* Application module for database connectivity
*
* @package Site
* @copyright 2004-2006 silverorange
*/
class SiteDatabaseModule extends SiteApplicationModule
{
// {{{ pub... |
Set Botamp Api Base from magento env value if defined. | <?php
namespace Botamp\Botamp\Resource;
class Resource {
protected $botamp;
public function __construct() {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$configHelper = $objectManager->create('\Botamp\Botamp\Helper\ConfigHelper');
$apiKey = $configHelper->getApiKey();
$t... | <?php
namespace Botamp\Botamp\Resource;
class Resource {
protected $botamp;
public function __construct() {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$configHelper = $objectManager->create('\Botamp\Botamp\Helper\ConfigHelper');
$configReader = $objectManager->create('\Magen... |
Add a blank line helper on markdown formatter | <?php
/*
* This file is part of the WizadDoctrineDocBundle.
*
* (c) William POTTIER <developer@william-pottier.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Wizad\DoctrineDocBundle\Formatter;
class MarkdownFormat... | <?php
/*
* This file is part of the WizadDoctrineDocBundle.
*
* (c) William POTTIER <developer@william-pottier.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Wizad\DoctrineDocBundle\Formatter;
class MarkdownFormat... |
Fix installer for completely new add-on | <?php
class SV_AttachmentImprovements_Installer
{
const AddonNameSpace = 'SV_AttachmentImprovements_';
public static function install($existingAddOn, $addOnData)
{
$version = isset($existingAddOn['version_id']) ? $existingAddOn['version_id'] : 0;
if ($version && $version < 1000200)
... | <?php
class SV_AttachmentImprovements_Installer
{
const AddonNameSpace = 'SV_AttachmentImprovements_';
public static function install($existingAddOn, $addOnData)
{
$version = isset($existingAddOn['version_id']) ? $existingAddOn['version_id'] : 0;
if ($version && $version < 1000200)
... |
Add Dept seeder to db seeder | <?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(CompanySeeder::class);
$this->call(Catego... | <?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(CompanySeeder::class);
$this->call(Catego... |
Update service provider to use bindShared. | <?php namespace Orchestra\Facile;
use Illuminate\Support\ServiceProvider;
class FacileServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var boolean
*/
protected $defer = true;
/**
* Register the service provider.
*
* ... | <?php namespace Orchestra\Facile;
use Illuminate\Support\ServiceProvider;
class FacileServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var boolean
*/
protected $defer = true;
/**
* Register the service provider.
*
* ... |
Test getenv au lieu d'une référence vers un paramètres | <?php
// app/config/security.php
$container->loadFromExtension('security', [
'encoders' => [
'Tm\UserBundle\Entity\Utilisateur' => 'sha512',
],
'role_hierarchy' => [
'ROLE_ADMIN' => 'ROLE_UTILISATEUR',
'ROLE_SUPER_ADMIN' => ['ROLE_ADMIN', 'ROLE_A... | <?php
// app/config/security.php
$container->loadFromExtension('security', [
'encoders' => [
'Tm\UserBundle\Entity\Utilisateur' => 'sha512',
],
'role_hierarchy' => [
'ROLE_ADMIN' => 'ROLE_UTILISATEUR',
'ROLE_SUPER_ADMIN' => ['ROLE_ADMIN', 'ROLE_A... |
Fix documentation for query builder | <?php
namespace SearchApi\Builders;
use SearchApi\Builders\QueryBuilder;
/**
* Class SolrQueryBuilder - Responsible for building a query string for SolrSearch.
*
* @method string build_query (SearchTerm[]|null $keywords, SearchApi\Models\SearchOptions|null)
* Build a query string from provided search terms and... | <?php
namespace SearchApi\Builders;
use SearchApi\Builders\QueryBuilder;
/**
* Class SolrQueryBuilder - Responsible for building a query string for SolrSearch
*/
class SolrQueryBuilder implements QueryBuilder {
/**
* Build a query string from provided search terms and search options
*/
function build( $k... |
Update calendar constructors to take in recurrence types. | <?php
namespace Plummer\Calendar;
class Calendar
{
protected $events;
protected $recurrenceTypes;
protected function __construct(\Iterator $events)
{
$this->events = $events;
}
public static function make(\Iterator $events)
{
return new static($events);
}
public function addEvents(array $events)
{
... | <?php
namespace Plummer\Calendar;
class Calendar
{
protected $events;
protected $recurrenceTypes;
protected function __construct(\Iterator $events, $recurrenceTypes)
{
$this->events = $events;
$this->addRecurrenceTypes($recurrenceTypes);
}
public static function make(\Iterator $events, $recurrenceTypes =... |
Allow ModuleManager objects to return null on findModuleBy | <?php
/*
* This file is part of the Harmony package.
*
* (c) Tim Goudriaan <tim@harmony-project.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Harmony\Component\ModularRouting\Manager;
use Harmony\Component\Modular... | <?php
/*
* This file is part of the Harmony package.
*
* (c) Tim Goudriaan <tim@harmony-project.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Harmony\Component\ModularRouting\Manager;
use Harmony\Component\Modular... |
Update the delete the .env file before installing message | <?php namespace Anomaly\StreamsDistribution\Http\Controller;
use Anomaly\Streams\Platform\Application\Application;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\StreamsDistribution\Form\InstallerFormBuilder;
/**
* Class InstallerController
*
* @link http://anomaly.is/streams-p... | <?php namespace Anomaly\StreamsDistribution\Http\Controller;
use Anomaly\Streams\Platform\Application\Application;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\StreamsDistribution\Form\InstallerFormBuilder;
/**
* Class InstallerController
*
* @link http://anomaly.is/streams-p... |
Allow mime-types like 'text/html; charset=utf-8' | <?php
namespace Hmaus\Spas\Formatter;
class FormatterService
{
/**
* @var Formatter[]
*/
private $formatters = [];
/**
* Add formatters to the service.
* Done by a compiler pass
*
* @param Formatter $formatter
*/
public function addFormatter(Formatter $formatter)
... | <?php
namespace Hmaus\Spas\Formatter;
class FormatterService
{
/**
* @var Formatter[]
*/
private $formatters = [];
/**
* Add formatters to the service.
* Done by a compiler pass
*
* @param Formatter $formatter
*/
public function addFormatter(Formatter $formatter)
... |
Make sure the handler can handle collections. Pun not intended. | <?php
namespace Phonect\SOAP;
use GuzzleHttp\Psr7\StreamDecoratorTrait;
use Psr\Http\Message\StreamInterface;
use RuntimeException;
class SoapStream implements StreamInterface
{
use StreamDecoratorTrait;
public function soapSerialize()
{
//fseek($this->getContents(), 0);
$this->seek(0);
$contents = (string... | <?php
namespace Phonect\SOAP;
use GuzzleHttp\Psr7\StreamDecoratorTrait;
use Psr\Http\Message\StreamInterface;
use RuntimeException;
class SoapStream implements StreamInterface
{
use StreamDecoratorTrait;
public function soapSerialize()
{
//fseek($this->getContents(), 0);
$this->seek(0);
$contents = (string... |
Add change in method signature to the interface also | <?php
namespace Ccovey\RabbitMQ;
interface QueuedMessageInterface
{
public function getQueueName() : string;
public function getDeliveryTag() : string;
public function getBody() : array;
public function getRawBody() : string;
public function fail();
public function isFailed() : bool;
}
| <?php
namespace Ccovey\RabbitMQ;
use Throwable;
interface QueuedMessageInterface
{
public function getQueueName() : string;
public function getDeliveryTag() : string;
public function getBody() : array;
public function getRawBody() : string;
public function fail(Throwable $throwable = null);
p... |
Remove responsive version abbreviation in footer | <footer class="main-footer">
<div class="pull-right">
<span class="hidden-xs">Version: </span><span class="visible-xs">v</span>{!! $version !!}
</div>
<span class="hidden-xs">
<i class="fa fa-github"></i> View this project on <a href="https://github.com/WaveHack/OpenDominion" target="_blan... | <footer class="main-footer">
<div class="pull-right">
<span class="hidden-xs">Version: </span>{!! $version !!}
</div>
<span class="hidden-xs">
<i class="fa fa-github"></i> View this project on <a href="https://github.com/WaveHack/OpenDominion" target="_blank">GitHub <i class="fa fa-externa... |
Add customer saving test case | <?php
class Stripe_CustomerTest extends UnitTestCase {
public function testDeletion() {
authorizeFromEnv();
$c = Stripe_Customer::create(array('amount' => 100,
'currency' => 'usd',
'card' => array('number' => '4242424242424242',
'exp_month' => 5,
'exp_year' => ... | <?php
class Stripe_CustomerTest extends UnitTestCase {
public function testDeletion() {
authorizeFromEnv();
$c = Stripe_Customer::create(array('amount' => 100,
'currency' => 'usd',
'card' => array('number' => '4242424242424242',
'exp_month' => 5,
'exp_year' => ... |
Remove always-throwing methods from AbstractSearchEngine | <?php
namespace wcf\system\search;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\NotImplementedException;
use wcf\system\SingletonFactory;
/**
* Default implementation for search engines, this class should be extended by
* all search engines to preserve compatibility in c... | <?php
namespace wcf\system\search;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\SingletonFactory;
/**
* Default implementation for search engines, this class should be extended by
* all search engines to preserve compatibility in case of interface changes.
*
* @author Alexander... |
Add option to fix deprecate warning in PHP8.1 | <?php
/**
* Created by PhpStorm.
* User: beroberts
* Date: 1/14/17
* Time: 8:57 AM
*/
namespace WF\Hypernova;
class Job implements \JsonSerializable
{
public $name;
public $data;
public $metadata;
public function __construct($name, $data, $metadata = [])
{
$this->name = $name;
... | <?php
/**
* Created by PhpStorm.
* User: beroberts
* Date: 1/14/17
* Time: 8:57 AM
*/
namespace WF\Hypernova;
class Job implements \JsonSerializable
{
public $name;
public $data;
public $metadata;
public function __construct($name, $data, $metadata = [])
{
$this->name = $name;
... |
Fix getMigrations method signature for migrations command | <?php
/*
* This file is part of the Active Collab Bootstrap project.
*
* (c) A51 doo <info@activecollab.com>. All rights reserved.
*/
namespace ActiveCollab\Bootstrap\Command\DevCommand\Migrations;
use ActiveCollab\Bootstrap\Command\DevCommand\DevCommand;
use ActiveCollab\DatabaseMigrations\MigrationsInterface;
... | <?php
/*
* This file is part of the Active Collab Bootstrap project.
*
* (c) A51 doo <info@activecollab.com>. All rights reserved.
*/
namespace ActiveCollab\Bootstrap\Command\DevCommand\Migrations;
use ActiveCollab\Bootstrap\Command\DevCommand\DevCommand;
use ActiveCollab\DatabaseMigrations\MigrationsInterface;
... |
Revert "Fix model trait code docs." | <?php
namespace Adldap\Models\Traits;
trait ModelTrait
{
/**
* Returns the current query builder.
*
* @return \Adldap\Query\Builder
*/
abstract public function getQuery();
/**
* Returns the current models schema.
*
* @return \Adldap\Contracts\Schemas\SchemaInterface
... | <?php
namespace Adldap\Models\Traits;
trait ModelTrait
{
/**
* {@inheritdoc}
*/
abstract public function getQuery();
/**
* {@inheritdoc}
*/
abstract public function getSchema();
/**
* {@inheritdoc}
*/
abstract public function getDn();
/**
* {@inheritdo... |
Add $_observer to Model_TaskQueue for overwrap | <?php
/**
* Queue wrapper
*/
class Model_TaskQueue extends \Queue\Model_TaskQueue
{
/**
* @override
*/
public static function notify($msg)
{
\HipChat::forge()->send_message($msg);
}
}
| <?php
/**
* Queue wrapper
*/
class Model_TaskQueue extends \Queue\Model_TaskQueue
{
/**
* @override
*/
protected static $_observers = array(
'Orm\\Observer_CreatedAt' => array(
'events' => array('before_insert'),
'mysql_timestamp' => true,
'property' => 'created_at',
),
'Orm\\Observer_UpdatedAt'... |
Switch usage of trees based on content-type | <?php
/**
* @license http://opensource.org/licenses/BSD-2-Clause BSD-2-Clause
*/
namespace ZF\Configuration;
use Zend\Mvc\Controller\AbstractActionController;
use ZF\ApiProblem\ApiProblem;
class ConfigController extends AbstractActionController
{
protected $config;
public function __construct(ConfigReso... | <?php
/**
* @license http://opensource.org/licenses/BSD-2-Clause BSD-2-Clause
*/
namespace ZF\Configuration;
use Zend\Mvc\Controller\AbstractActionController;
use ZF\ApiProblem\ApiProblem;
class ConfigController extends AbstractActionController
{
protected $config;
public function __construct(ConfigReso... |
Fix indentation according to coding standards | <?php
/**
* This file is part of the hyyan/woo-poly-integration plugin.
* (c) Hyyan Abo Fakher <hyyanaf@gmail.com>.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Hyyan\WPI;
/**
* Ajax.
*
* Handle Ajax
*
* @author... | <?php
/**
* This file is part of the hyyan/woo-poly-integration plugin.
* (c) Hyyan Abo Fakher <hyyanaf@gmail.com>.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Hyyan\WPI;
/**
* Ajax.
*
* Handle Ajax
*
* @author... |
Remove turn off Error Handler for Production environment | <?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Report All Errors
*
* By setting error reporting to -1, we essentially force PHP to report
* every error, and this is guranteed to show every error on future
* releases of PHP. This allows everything to be fixed early!
*/
error_reporting(-... | <?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra requires PHP 5.2.3 or greater
*/
if (version_compare(PHP_VERSION, "5.2.3", "<")) {
exit("Monstra requires PHP 5.2.3 or greater.");
}
/**
* Include Monstra Engine
*/
include ROOT . DS .'engine'. DS .'Monstra.php';
/**
* Set M... |
Add constructor, growl, and createCommand methods | <?php
namespace BryanCrowe;
class Growl
{
}
| <?php
namespace BryanCrowe;
class Growl
{
public function __construct() {}
public function growl($message = null, $options = []) {}
public function createCommand()
{
switch (PHP_OS) {
case 'Darwin':
$command = [];
break;
case 'Linux':
... |
Change internal iface to eth0 | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
class Meta extends REST_Controller {
public function index_get()
{
$response = array(
'id' => 'sw',
'name' => 'Scaleway',
'server_nick_name' => 'Server',
'default_region' => 'par1',... | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
class Meta extends REST_Controller {
public function index_get()
{
$response = array(
'id' => 'sw',
'name' => 'Scaleway',
'server_nick_name' => 'Server',
'default_region' => 'par1',... |
Correct URI in example request for PHP | ```php
$client = new \GuzzleHttp\Client();
$response = $client->{{ strtolower($route['methods'][0]) }}("{{ rtrim($baseUrl, '/') . '/' . $route['boundUri'] }}", [
@if(!empty($route['headers']))
'headers' => [
@foreach($route['headers'] as $header => $value)
"{{$header}}" => "{{$value}}",
@endforeach... | ```php
$client = new \GuzzleHttp\Client();
$response = $client->{{ strtolower($route['methods'][0]) }}("{{ rtrim($baseUrl, '/') . '/' . ltrim($route['boundUri'], '/') }}", [
@if(!empty($route['headers']))
'headers' => [
@foreach($route['headers'] as $header => $value)
"{{$header}}" => "{{$value}}",
... |
Include doctrine/collections in API docs | <?php
/*
* This file is part of nochso/benchmark.
*
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
* @license https://github.com/nochso/benchmark/blob/master/LICENSE ISC
* @link https://github.com/nochso/benchmark
*/
return new Sami\Sami('src', array(
'title' => 'nochso/Benchmark documenta... | <?php
/*
* This file is part of nochso/benchmark.
*
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
* @license https://github.com/nochso/benchmark/blob/master/LICENSE ISC
* @link https://github.com/nochso/benchmark
*/
use Symfony\Component\Finder\Finder;
$iterator = Finder::create()
->file... |
Fix symlink lookup: excludePattern shoud be used as path so it doesn't recurse into excludes paths | <?php
namespace Kwf\FileWatcher\Helper;
use Symfony\Component\Finder\Finder;
class Links
{
public static function followLinks(array $paths, $excludePatterns)
{
$finder = new Finder();
$finder->directories();
foreach ($excludePatterns as $excludePattern) {
$finder->notName($e... | <?php
namespace Kwf\FileWatcher\Helper;
use Symfony\Component\Finder\Finder;
class Links
{
public static function followLinks(array $paths, $excludePatterns)
{
$finder = new Finder();
$finder->directories();
foreach ($excludePatterns as $excludePattern) {
$finder->notPath($e... |
Add default value in case missing. | <?php
namespace Orchestra\Foundation\Jobs;
use Orchestra\Contracts\Authorization\Authorization;
use Orchestra\Model\Role;
class SyncDefaultAuthorization extends Job
{
/**
* Re-sync administrator access control.
*
* @param \Orchestra\Contracts\Authorization\Authorization $acl
*
* @retur... | <?php
namespace Orchestra\Foundation\Jobs;
use Orchestra\Contracts\Authorization\Authorization;
use Orchestra\Model\Role;
class SyncDefaultAuthorization extends Job
{
/**
* Re-sync administrator access control.
*
* @param \Orchestra\Contracts\Authorization\Authorization $acl
*
* @retur... |
Update manifest paths to use variables | <?php
namespace CFPropertyList;
require_once( 'cfpropertylist-2.0.1/CFPropertyList.php' );
// Get the munki repo directory
$plist = new CFPropertyList( '/Library/Preferences/com.github.munki.plist' );
$arrPref = $plist->toArray();
$munki_repo = $arrPref['MUNKI_REPO'];
// Get the varibles passed b... | <?php
namespace CFPropertyList;
require_once( 'cfpropertylist-2.0.1/CFPropertyList.php' );
// Get the munki repo directory
$plist = new CFPropertyList( '/Library/Preferences/com.github.munki.plist' );
$arrPref = $plist->toArray();
$munki_repo = $arrPref['MUNKI_REPO'];
// Get the varib... |
Fix performance issue with publishing images | <?php
namespace JonoM\FocusPoint\Extensions;
use JonoM\FocusPoint\Dev\FocusPointMigrationTask;
use JonoM\FocusPoint\FieldType\DBFocusPoint;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Storage\DBFile;
/**
* FocusPoint Image extension.
* Extends Image to allow automatic cropping from a selected focus poin... | <?php
namespace JonoM\FocusPoint\Extensions;
use JonoM\FocusPoint\Dev\FocusPointMigrationTask;
use JonoM\FocusPoint\FieldType\DBFocusPoint;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Storage\DBFile;
/**
* FocusPoint Image extension.
* Extends Image to allow automatic cropping from a selected focus poin... |
Use git version of gl-matrix, since it has some functions we could use | <html>
<head>
<title>WebEL</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="gl-matrix-2.1.0.js"></script>
<script type="text/javascript" src="webgl-utils.js"></script>
<script type="text/javascript" src="jquery-2.1.3.js"></script>
<scrip... | <html>
<head>
<title>WebEL</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="gl-matrix.js"></script>
<script type="text/javascript" src="webgl-utils.js"></script>
<script type="text/javascript" src="jquery-2.1.3.js"></script>
<script type... |
Add pressure measurement, improve syntax of INSERT statement. | <?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
// Connect to MySQL
include("dbconnect.php");
// Prepare the SQL statement
$sensor = $_GET["serial"];
$celsius = $_GET["temperature"];
$humidity = $_GET["humidity"];
$SQL = "INSERT INTO `dht22` (sensor,celsius,humidity) VALUES ($sensor,$celsiu... | <?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
// Connect to MySQL
include("dbconnect.php");
// Prepare the SQL statement
$sensor = $_GET["serial"];
$celsius = $_GET["temperature"];
$humidity = $_GET["humidity"];
$pressure = $_GET["pressure"];
echo "Sensor: " . $sensor . PHP_EOL;
echo "Temp... |
Use the (English) label instead of the name for export | <?php
/**
* Subclass for representing a row from the 'profile_property' table.
*
*
*
* @package lib.model
*/
class ProfileProperty extends BaseProfileProperty
{
/**
* to string
*
* @return string
*/
public function __toString()
{
return $this->getLabel();
}
/**
* @param int $counter
... | <?php
/**
* Subclass for representing a row from the 'profile_property' table.
*
*
*
* @package lib.model
*/
class ProfileProperty extends BaseProfileProperty
{
/**
* to string
*
* @return string
*/
public function __toString()
{
return $this->getLabel();
}
/**
* @param int $counter
... |
Enable preventing remote access to debug environment on production server | <?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
// This chec... | <?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
// This chec... |
Add a minor change to the morph has many relation | <?php
namespace CloudCreativity\LaravelJsonApi\Eloquent;
use CloudCreativity\JsonApi\Contracts\Store\RelationshipAdapterInterface;
use Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface;
class MorphHasMany implements RelationshipAdapterInterface
{
/**
* @var HasMany[]
*/
priv... | <?php
namespace CloudCreativity\LaravelJsonApi\Eloquent;
use CloudCreativity\JsonApi\Contracts\Store\RelationshipAdapterInterface;
use Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface;
class MorphHasMany implements RelationshipAdapterInterface
{
/**
* @var HasMany[]
*/
priv... |
Hide two more settings menu from ewww image optimizer | <?php
/*
* Plugin Name: Hide Menu
* Plugin URI: http://pothi.info
* Author: Pothi Kalimuthu
* Author URI: http://pothi.info
* Description: Hides unneccessary menu item/s
* Version: 1.0
* License: Apache 2.0
*/
function tiny_remove_menus() {
// Hide Ewww image optimizer settings that are found in two place... | <?php
/*
* Plugin Name: Hide Menu
* Plugin URI: http://pothi.info
* Author: Pothi Kalimuthu
* Author URI: http://pothi.info
* Description: Hides unneccessary menu item/s
* Version: 1.0
* License: Apache 2.0
*/
function tiny_remove_menus() {
// Hide Ewww image optimizer settings that are found in four plac... |
Fix count -> strlen bug | <?php
/**
* Input receiver for SMTP server piping
* In your application file: list($message, $additionalData) = require('$path_to_smp/includes/message-pipe.php');
* Usage for Exim4 filter file: pipe "php $path_to_bin/your_application.php $sender_address"
* Raw mail body given on STDIN
*/
if ($argc < 2) {
die... | <?php
/**
* Input receiver for SMTP server piping
* In your application file: list($message, $additionalData) = require('$path_to_smp/includes/message-pipe.php');
* Usage for Exim4 filter file: pipe "php $path_to_bin/your_application.php $sender_address"
* Raw mail body given on STDIN
*/
if ($argc < 2) {
die... |
Add read only functionnality on published node | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... |
Add more test on default connection | <?php
namespace Leezy\PheanstalkBundle\Tests;
use Leezy\PheanstalkBundle\ConnectionLocator;
class ConnectionLocatorTest extends \PHPUnit_Framework_TestCase {
public function testDefaultConnections()
{
$connectionLocator = new ConnectionLocator();
$this->assertNotNull($connectionLocat... | <?php
namespace Leezy\PheanstalkBundle\Tests;
use Leezy\PheanstalkBundle\ConnectionLocator;
class ConnectionLocatorTest extends \PHPUnit_Framework_TestCase {
public function testDefaultConnections()
{
$connectionLocator = new ConnectionLocator();
$this->assertNotNull($connectionLocat... |
TEST - See what happens | <?php
class HomePage extends Page
{
static $db = array();
static $has_one = array();
static $icon = 'sprocketHomePage/images/homePage';
}
class HomePage_Controller extends Page_Controller
{
public function init() {
parent::init();
// TEMPORARY
// Require jQuery for splash area
Requirements::javascri... | <?php
class HomePage extends Page
{
static $db = array();
static $has_one = array();
static $icon = 'sprocketHomePage/images/homePage';
}
class HomePage_Controller extends Page_Controller
{
public function init() {
parent::init();
// TEMPORARY Test
// Require jQuery for splash area
Requirements::ja... |
Remove login page title to remove it from navigation | <?php
/**
* Login
* @author Jon Johnson <jon.johnson@ucsf.edu>
* @license http://jazzee.org/license.txt
* @package jazzee
* @subpackage admin
*/
class AdminLoginController extends \Jazzee\AdminController {
const MENU = '';
const TITLE = 'Login';
const PATH = 'login';
const REQUIRE_AUTHORIZATION = false;
... | <?php
/**
* Login
* @author Jon Johnson <jon.johnson@ucsf.edu>
* @license http://jazzee.org/license.txt
* @package jazzee
* @subpackage admin
*/
class AdminLoginController extends \Jazzee\AdminController {
const MENU = 'My Account';
const TITLE = '';
const PATH = 'login';
const REQUIRE_AUTHORIZATION = fal... |
Fix the provides method for the ServiceProvider | <?php namespace Antoineaugusti\LaravelEasyrec;
use Illuminate\Support\ServiceProvider;
class LaravelEasyrecServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return... | <?php namespace Antoineaugusti\LaravelEasyrec;
use Illuminate\Support\ServiceProvider;
class LaravelEasyrecServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return... |
Set the name in the alias constructor. | <?php
namespace MusicBrainz\Value;
use MusicBrainz\Helper\ArrayAccess;
use MusicBrainz\Value;
/**
* Aliases are variant names that are mostly used as search help: if a search matches an entity's alias, the entity will
* be given as a result - even if the actual name wouldn't be.
*
* @see https://musicbrainz.org/... | <?php
namespace MusicBrainz\Value;
use MusicBrainz\Helper\ArrayAccess;
use MusicBrainz\Value;
/**
* Aliases are variant names that are mostly used as search help: if a search matches an entity's alias, the entity will
* be given as a result - even if the actual name wouldn't be.
*
* @see https://musicbrainz.org/... |
Fix posts factory content binding | <?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding you... | <?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding you... |
Fix code style by phpcbf, make travis green again! | <?php
namespace Sirius\Validation\Rule;
class Website extends AbstractRule
{
const WEBSITE_REGEX = '@^((http|https)\:)//.+$@i';
const MESSAGE = 'This input must be a valid website address';
const LABELED_MESSAGE = '{label} must be a valid website address';
public function validate($value, $valueIdent... | <?php
namespace Sirius\Validation\Rule;
class Website extends AbstractRule
{
const WEBSITE_REGEX = '@^((http|https)\:)//.+$@i';
const MESSAGE = 'This input must be a valid website address';
const LABELED_MESSAGE = '{label} must be a valid website address';
public function validate($value, $valueIdent... |
Allow homebrew to be installed in non-standard locations | <?php
/**
* Check the system's compatibility with Valet.
*/
$inTestingEnvironment = strpos($_SERVER['SCRIPT_NAME'], 'phpunit') !== false;
if (PHP_OS !== 'Darwin' && ! $inTestingEnvironment) {
echo 'Valet only supports the Mac operating system.'.PHP_EOL;
exit(1);
}
if (version_compare(PHP_VERSION, '5.5.9',... | <?php
/**
* Check the system's compatibility with Valet.
*/
$inTestingEnvironment = strpos($_SERVER['SCRIPT_NAME'], 'phpunit') !== false;
if (PHP_OS !== 'Darwin' && ! $inTestingEnvironment) {
echo 'Valet only supports the Mac operating system.'.PHP_EOL;
exit(1);
}
if (version_compare(PHP_VERSION, '5.5.9',... |
Use path.public to set 'public' folder location | <?php namespace Illuminate\Foundation\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class ServeCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'serve';
/**
* The console command description.
*
* @var string
... | <?php namespace Illuminate\Foundation\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class ServeCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'serve';
/**
* The console command description.
*
* @var string
... |
Include csrf-token into JWT on every web request | <?php
namespace Infrastructure\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $m... | <?php
namespace Infrastructure\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $m... |
Add test for validSchemaCommand throwException | <?php
declare(strict_types=1);
namespace Overblog\GraphQLBundle\Tests\Functional\Command;
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;
class ValidateCommandTest extends TestCase
{
/** @var Command */
... | <?php
declare(strict_types=1);
namespace Overblog\GraphQLBundle\Tests\Functional\Command;
use GraphQL\Error\InvariantViolation;
use Overblog\GraphQLBundle\Command\ValidateCommand;
use Overblog\GraphQLBundle\Definition\Type\ExtensibleSchema;
use Overblog\GraphQLBundle\Request\Executor;
use Overblog\GraphQLBundle\Test... |
Update template path to reflect multiple format support in the default SimpleChannelFrontend templates. | <?php
require_once 'config.inc.php';
$options = $_GET;
if (isset($_SERVER['REDIRECT_URL'])) {
$options['view'] = 'package';
preg_match('/\/(?<package>[0-9a-z_]+)(-(?<version>[0-9ab.]+))?$/i',
$_SERVER['REDIRECT_URL'], $matches);
$options['package'] = $matches['package'];
if (isset($matches['v... | <?php
require_once 'config.inc.php';
$options = $_GET;
if (isset($_SERVER['REDIRECT_URL'])) {
$options['view'] = 'package';
preg_match('/\/(?<package>[0-9a-z_]+)(-(?<version>[0-9ab.]+))?$/i',
$_SERVER['REDIRECT_URL'], $matches);
$options['package'] = $matches['package'];
if (isset($matches['v... |
Add test for NQuads roundtrip with escaping | <?php
/*
* (c) Markus Lanthaler <mail@markus-lanthaler.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ML\JsonLD\Test;
use ML\JsonLD\NQuads;
/**
* Tests NQuads
*
* @author Markus Lanthaler <mail@markus-lanthaler... | <?php
/*
* (c) Markus Lanthaler <mail@markus-lanthaler.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ML\JsonLD\Test;
use ML\JsonLD\JsonLD;
use ML\JsonLD\NQuads;
/**
* Tests NQuads
*
* @author Markus Lanthaler ... |
Add message to exception to inform which class is Brobdingnagian | <?php
namespace Elfiggo\Brobdingnagian\Detector;
use ReflectionClass;
class ClassSize
{
/**
* @var ReflectionClass
*/
private $sus;
public function __construct(ReflectionClass $sus)
{
$this->sus = $sus;
}
/**
* @throws \Elfiggo\Brobdingnagian\Exception\ClassSizeTooLa... | <?php
namespace Elfiggo\Brobdingnagian\Detector;
use ReflectionClass;
class ClassSize
{
/**
* @var ReflectionClass
*/
private $sus;
public function __construct(ReflectionClass $sus)
{
$this->sus = $sus;
}
/**
* @throws \Elfiggo\Brobdingnagian\Exception\ClassSizeTooLa... |
Check whether the asset url start with a slash | <?php
use Silex\Application;
use Silex\Provider\TwigServiceProvider;
use Silex\Provider\RoutingServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\HttpFragmentServiceProvider;
$app = new Application();
$app->register(new RoutingServiceP... | <?php
use Silex\Application;
use Silex\Provider\TwigServiceProvider;
use Silex\Provider\RoutingServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\HttpFragmentServiceProvider;
$app = new Application();
$app->register(new RoutingServiceP... |
Set cookies to be HTTP only | <?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\Forum\Actions;
use Dflydev\FigCookies\FigResponseCookies;
use Dflydev\FigCookies... | <?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\Forum\Actions;
use Dflydev\FigCookies\FigResponseCookies;
use Dflydev\FigCookies... |
Fix sfEventLogger: add priority and event.name overriding | <?php
/**
* sfEventLogger sends log messages to the event dispatcher to be processed
* by registered loggers.
*
* @package symfony
* @subpackage log
* @author Jérôme Tamarelle <jtamarelle@groupe-exp.com>
*/
class sfEventLogger extends sfLogger
{
/**
* {@inheritDoc}
*/
public function initialize... | <?php
/**
* sfEventLogger sends log messages to the event dispatcher to be processed
* by registered loggers.
*
* @package symfony
* @subpackage log
* @author Jérôme Tamarelle <jtamarelle@groupe-exp.com>
*/
class sfEventLogger extends sfLogger
{
/**
* {@inheritDoc}
*/
public function initialize... |
Add check for even number of hex digits | <?php
require 'hex2base64.php';
if ($argc == 1) {
$input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d";
$target = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t";
$output = hex2base64($input);
echo "Input : $input\n";
echo "Target:... | <?php
require 'hex2base64.php';
if ($argc == 1) {
$input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d";
$target = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t";
$output = hex2base64($input);
echo "Input : $input\n";
echo "Target:... |
Allow the factory to specify a cookieStorage object | <?php
namespace Rosio\EncryptedCookie;
use Rosio\EncryptedCookie\CryptoSystem\iCryptoSystem;
class CookieFactory
{
private $cryptoSystem;
function __construct (iCryptoSystem $cryptoSystem)
{
$this->cryptoSystem = $cryptoSystem;
}
function create ($name)
{
$cookie = new EncryptedCookie ($name);
$cookie-... | <?php
namespace Rosio\EncryptedCookie;
use Rosio\EncryptedCookie\CryptoSystem\iCryptoSystem;
use Rosio\EncryptedCookie\CookieStorage;
class CookieFactory
{
private $cryptoSystem;
private $cookieStorage;
function __construct (iCryptoSystem $cryptoSystem, CookieStorage $cookieStorage = null)
{
$this->cryptoSyst... |
Remove database patch that depends on LDAP | <?php
// Assign a UUID to all users in LDAP
/**
* DbPatch makes the following variables available to PHP patches:
*
* @var $this DbPatch_Command_Patch_PHP
* @var $writer DbPatch_Core_Writer
* @var $db Zend_Db_Adapter_Abstract
* @var $phpFile string
*/
$ldapConfig = EngineBlock_ApplicationS... | <?php
// Assign a UUID to all users in LDAP
// This patch can no longer be executed as it required LDAP to function.
// Since the DB Patch tool requires the patches to be sequential and fails if a patch is missing, we have simply emptied
// this patch.
|
Call getName on currencyType so extensions are invoked | <?php
namespace Tbbc\MoneyBundle\Form\Type;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Tbbc\MoneyBundle\Form\DataTransformer\MoneyToArrayTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Tbbc\MoneyBundle\Form\Type\CurrencyType;
/**
* Form ty... | <?php
namespace Tbbc\MoneyBundle\Form\Type;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Tbbc\MoneyBundle\Form\DataTransformer\MoneyToArrayTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Tbbc\MoneyBundle\Form\Type\CurrencyType;
/**
* Form ty... |
Add columns to polls table | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAnswersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('answers', funct... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAnswersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('answers', funct... |
Cover new method with a quick test | <?php
class TestTimberContext extends Timber_UnitTestCase {
/**
* This throws an infite loop if memorization isn't working
*/
function testContextLoop() {
add_filter('timber_context', function($context) {
$context = Timber::get_context();
$context['zebra'] = 'silly horse';
return $context;
});
$c... | <?php
class TestTimberContext extends Timber_UnitTestCase {
/**
* This throws an infite loop if memorization isn't working
*/
function testContextLoop() {
add_filter('timber_context', function($context) {
$context = Timber::get_context();
$context['zebra'] = 'silly horse';
return $context;
});
$c... |
Rename var path & change title value | <?php
namespace Drupal\acme\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Slang Default Controller
*/
class DemoController implements ContainerInjectionInterface {
/**
* @var \TwigEnvironment
*/
protected $... | <?php
namespace Drupal\acme\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Slang Default Controller
*/
class DemoController implements ContainerInjectionInterface {
/**
* @var \TwigEnvironment
*/
protected $... |
Improve search selections with internal options for parameters Allow itemsPerPage in RSS | <?php
/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Integrated\Bundle\WebsiteBundle\Controller;
use Symfony\Bundle\Fram... | <?php
/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Integrated\Bundle\WebsiteBundle\Controller;
use Symfony\Bundle\Fram... |
HIde ACL menu for now. | <div class="navbar">
<div class="navbar-inner">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#authorizenav">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{{ HTML::link(handles('orchestra::resources/authorize'... | <div class="navbar">
<div class="navbar-inner">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#authorizenav">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{{ HTML::link(handles('orchestra::resources/authorize'... |
Add an error message when there are no posts | <?php
if (is_paged()) :
get_template_part('index', get_post_format()); else :
wp_enqueue_script("twp-enable-masonry", get_template_directory_uri() . "/js/enable-masonry.js",
array ("jquery-masonry"));
get_header();
?>
<section class="container">
<?php
the_post();
get_template_part('content/her... | <?php
if (is_paged()) :
get_template_part('index', get_post_format()); else :
wp_enqueue_script("twp-enable-masonry", get_template_directory_uri() . "/js/enable-masonry.js",
array ("jquery-masonry"));
get_header();
?>
<section class="container">
<?php if (!have_posts()): ?>
<div class="alert ale... |
Allow chaining of initialize method | <?php
namespace Harp\RandomKey\Repo;
use Harp\Core\Repo\Event;
/**
* @author Ivan Kerin <ikerin@gmail.com>
* @copyright 2014, Clippings Ltd.
* @license http://spdx.org/licenses/BSD-3-Clause
*/
trait RandomKeyTrait
{
/**
* @param int $event
* @param \Closure|object|array $call... | <?php
namespace Harp\RandomKey\Repo;
use Harp\Core\Repo\Event;
/**
* @author Ivan Kerin <ikerin@gmail.com>
* @copyright 2014, Clippings Ltd.
* @license http://spdx.org/licenses/BSD-3-Clause
*/
trait RandomKeyTrait
{
/**
* @param int $event
* @param \Closure|object|array $call... |
Remove widgets.php as it causes problems | <?php
// Get variables with configuration
require('config.php');
// General Stuff
require('hooks.php');
// All elements in backend
require('elements.php');
// Widgets
require('widgets.php');
// Theme-options
require('theme-options.php');
// Post-options
require('post-options.php');
| <?php
// Get variables with configuration
require('config.php');
// General Stuff
require('hooks.php');
// All elements in backend
require('elements.php');
// Widgets
// require('widgets.php');
// Theme-options
require('theme-options.php');
// Post-options
require('post-options.php');
// Save all options
require... |
Use singleton() for service binding as Laravel 5.4 depreciated share() method | <?php namespace MartinLindhe\VueInternationalizationGenerator;
use Illuminate\Support\ServiceProvider;
class GeneratorProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Perform post-registrat... | <?php namespace MartinLindhe\VueInternationalizationGenerator;
use Illuminate\Support\ServiceProvider;
class GeneratorProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Perform post-registrat... |
Remove category-model-widget cache po zapisie forma widgetu | <?php
/**
* Mmi Framework (https://github.com/milejko/mmi.git)
*
* @link https://github.com/milejko/mmi.git
* @copyright Copyright (c) 2010-2016 Mariusz Miłejko (http://milejko.com)
* @license http://milejko.com/new-bsd.txt New BSD License
*/
namespace CmsAdmin\Form;
/**
* Formularz widgetu tekstow... | <?php
/**
* Mmi Framework (https://github.com/milejko/mmi.git)
*
* @link https://github.com/milejko/mmi.git
* @copyright Copyright (c) 2010-2016 Mariusz Miłejko (http://milejko.com)
* @license http://milejko.com/new-bsd.txt New BSD License
*/
namespace CmsAdmin\Form;
/**
* Formularz widgetu z podpi... |
Replace escaped keywords in attributes. | <?php
/**
* Performs simple keyword replacement on the email before sending.
*
* @package silverstripe-newsletter-keywords
*/
class NewsletterEmailKeywordsExtension extends Extension {
public function onBeforeSend() {
$body = $this->owner->Body();
$replacements = $this->owner->Newsletter()->getKeyword... | <?php
/**
* Performs simple keyword replacement on the email before sending.
*
* @package silverstripe-newsletter-keywords
*/
class NewsletterEmailKeywordsExtension extends Extension {
public function onBeforeSend() {
$body = $this->owner->Body();
$replacements = $this->owner->Newsletter()->getKeyword... |
Check exclusions before saving data | <?php
include("file.php");
$experiment = new Experiment($_REQUEST['exp'], True);
$user = new User($experiment->owner);
$page_header = $experiment->getName();
if ($experiment->getStatus() != 'open') {
$page = 'fully_subscribed';
}
else {
foreach ($experiment->getCalendar() as $date=>$slots) {
foreach ($slot... | <?php
include("file.php");
$experiment = new Experiment($_REQUEST['exp'], True);
$user = new User($experiment->owner);
$page_header = $experiment->getName();
if ($experiment->getStatus() != 'open') {
$page = 'fully_subscribed';
}
else {
$excluded_email_addresses = $experiment->getExclusionEmails();
foreach ... |
Add new interface for type | <?php namespace Walisph\Merchant;
interface ProductInterface {
public function getProductName();
public function getDescription();
public function getPrice();
public function getManufacturer();
public function getBrand();
public function getProductModel();
}
| <?php namespace Walisph\Merchant;
interface ProductInterface {
public function getProductName();
public function getDescription();
public function getPrice();
public function getManufacturer();
public function getBrand();
public function getProductModel();
public function getType();
}
|
Fix compatibility isssues with Phinx 0.11 | <?php
use Migrations\AbstractMigration;
class RenameGroupsTable 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 change()
... | <?php
use Migrations\AbstractMigration;
class RenameGroupsTable 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 change()
... |
Add default val for param | <?php
namespace ryancco\forker;
interface JobInterface
{
public function __invoke($instanceNumber);
public function __destruct();
}
| <?php
namespace ryancco\forker;
interface JobInterface
{
public function __invoke($instanceNumber = 1);
public function __destruct();
}
|
Fix for /whoami with a user who doesn't have a profile picture | <?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot... | <?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot... |
Fix ability to set timeout when off | <?php
include "db.php";
const DEFAULT_TIMEOUT = 30;
const MIN_TEMP = 10.0;
const MAX_TEMP = 20.0;
$message = $_POST["message"];
if (!isset($message)) {
return;
}
$message = substr($message, 1);
$message = explode("-", $message);
$operation = $message[0];
$value = doubleval(... | <?php
include "db.php";
const DEFAULT_TIMEOUT = 30;
const MIN_TEMP = 10.0;
const MAX_TEMP = 20.0;
$message = $_POST["message"];
if (!isset($message)) {
return;
}
$message = substr($message, 1);
$message = explode("-", $message);
$operation = $message[0];
$value = doubleval(... |
Fix for if customer leaves checkout, then add products and goes to checkout, | <?php
/**
* Created by PhpStorm.
* User: Boxedsolutions
* Date: 2016-10-19
* Time: 12:52
*/
class Billmate_Common_Block_Checkout extends Mage_Core_Block_Template
{
public function getCheckoutUrl()
{
if(Mage::getSingleton('checkout/session')->getBillmateHash()){
$billmate = Mage::helper... | <?php
/**
* Created by PhpStorm.
* User: Boxedsolutions
* Date: 2016-10-19
* Time: 12:52
*/
class Billmate_Common_Block_Checkout extends Mage_Core_Block_Template
{
public function getCheckoutUrl()
{
if(Mage::getSingleton('checkout/session')->getBillmateHash()){
$billmate = Mage::helper... |
Make blog one column if sidebar isn't active. | <?php get_header(); ?>
<div class="container">
<div class="row">
<!-- Main Content -->
<div class="col-md-8 col-xs-12">
<h2 class="page-header"><?php wp_title(''); ?></h2>
<div class="blog-posts">
<?php get_template_part( 'content', get_post_format() ); ?>
</div>
</div>
<?php get_sidebar(); ?>
</... | <?php get_header(); ?>
<div class="container">
<div class="row">
<!-- Main Content -->
<?php if ( is_active_sidebar('blog_sidebar') ) {
echo ('<div class="col-md-8 col-xs-12">');
}
else {
echo ('<div class="col-md-8 col-xs-12 col-md-offset-2">');
}
?>
<h2 class="page-header"><?php wp_t... |
Update wording of the confirmation email | Hey {{ $username }}!
Someone (hopefully you!) has signed up to the forum '{{ $forumTitle }}' with this email address.
If this was you, simply visit the following link and your account will be activated:
{{ $url }}
If you did not sign up, just simply ignore this email.
| Hey {{ $username }}!
Someone (hopefully you!) has signed up to the forum '{{ $forumTitle }}' with this email address.
If this was you, simply visit the following link and your account will be activated:
{{ $url }}
If you did not sign up, please ignore this email.
|
Use include_once() instead of include(). | <?php
$settings = array(
'classes' => array('home'),
'title' => 'Titel',
'description' => 'Beschreibung',
);
include('inc/header.inc.php');
?>
<h1>Startseite</h1>
<p>Inhalt</p>
<?php include('inc/footer.inc.php'); ?>
| <?php
$settings = array(
'classes' => array('home'),
'title' => 'Titel',
'description' => 'Beschreibung',
);
include_once('inc/header.inc.php');
?>
<h1>Startseite</h1>
<p>Inhalt</p>
<?php include_once('inc/footer.inc.php'); ?>
|
Add 'public' visibilty to abstract 'getContainer' method. | <?php
namespace Robo;
trait TaskAccessor
{
/**
* Commands that use TaskAccessor must provide 'getContainer()'.
*/
abstract function getContainer();
/**
* Convenience function. Use:
*
* $this->task('Foo', $a, $b);
*
* instead of:
*
* $this->getContainer()->get('... | <?php
namespace Robo;
trait TaskAccessor
{
/**
* Commands that use TaskAccessor must provide 'getContainer()'.
*/
public abstract function getContainer();
/**
* Convenience function. Use:
*
* $this->task('Foo', $a, $b);
*
* instead of:
*
* $this->getContainer()... |
Remove signature and fix new line | <?php
namespace ActiveCollab\EmailReplyExtractor\Extractor;
/**
* @package ActiveCollab\EmailReplyExtractor\Extractor
*/
final class YahooExtractor extends Extractor
{
/**
* Return splitters
*
* @return array
*/
protected function getOriginalMessageSplitters()
{
retu... | <?php
namespace ActiveCollab\EmailReplyExtractor\Extractor;
/**
* @package ActiveCollab\EmailReplyExtractor\Extractor
*/
final class YahooExtractor extends Extractor
{
/**
* Return splitters
*
* @return array
*/
protected function getOriginalMessageSplitters()
{
retu... |
Remove PHP error on PHP5.2 | <?php
if ( $main_content ) {
$page->find( '.main' )[0]->innertext = $main_content;
}
?>
| <?php
if ( $main_content ) {
$mains = $page->find( '.main' );
if ( count( $mains ) > 0 ) {
$mains[ 0 ]->innertext = $main_content;
}
}
?>
|
Allow dev env for remote | <?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.
*/
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
/*
* Sylius front c... | <?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.
*/
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
/*
* Sylius front c... |
Fix spaces in path breaking for scss filter | <?php
App::uses('AssetFilter', 'AssetCompress.Lib');
/**
* Pre-processing filter that adds support for SCSS files.
*
* Requires ruby and sass rubygem to be installed
*
* @see http://sass-lang.com/
*/
class ScssFilter extends AssetFilter {
protected $_settings = array(
'ext' => '.scss',
'sass' => '/usr/bin/... | <?php
App::uses('AssetFilter', 'AssetCompress.Lib');
/**
* Pre-processing filter that adds support for SCSS files.
*
* Requires ruby and sass rubygem to be installed
*
* @see http://sass-lang.com/
*/
class ScssFilter extends AssetFilter {
protected $_settings = array(
'ext' => '.scss',
'sass' => '/usr/bin/... |
Add check whether layout option is set | <?php
abstract class Layoutable {
/**
* associative array of layout settings
*
* @var array
*/
private $layout = array();
/**
* get array of layout settings
*
* @return array
*/
public function getLayout(){
return $this->layout;
}
/**
... | <?php
abstract class Layoutable {
/**
* associative array of layout settings
*
* @var array
*/
private $layout = array();
/**
* get array of layout settings
*
* @return array
*/
public function getLayout(){
return $this->layout;
}
/**
... |
Handle InnoDB Deadlocks By Re-Attempting Transactions | <?php
namespace Illuminate\Database;
use Exception;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Exception $e
* @return bool
*/
protected function causedByLostConnection(Exception $e)
... | <?php
namespace Illuminate\Database;
use Exception;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Exception $e
* @return bool
*/
protected function causedByLostConnection(Exception $e)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.