Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Expand function for grid->image column | <?php
namespace Encore\Admin\Grid\Displayers;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Facades\Storage;
class Image extends AbstractDisplayer
{
public function display($server = '', $width = 200, $height = 200)
{
if ($this->value instanceof Arrayable) {
$this->va... | <?php
namespace Encore\Admin\Grid\Displayers;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Facades\Storage;
use Encore\Admin\Admin;
class Image extends AbstractDisplayer
{
public function display($server = '', $width = 200, $height = 200, $expand = false)
{
if ($this->value inst... |
Use ** operator over function pow() | <?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
{
public function compile(Twig_Com... | <?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
{
public function operator(Twig_Co... |
Add ability to configure a platform-specific type. | <?php
/**
* PHP version 7.1
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
namespace ComPHPPuebla\Fixtures\Connections;
use Doctrine\DBAL\Connection as DbConnection;
class DBALConnection implements Connection
{
/** @var DbConnection */
protected $c... | <?php
/**
* PHP version 7.1
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
namespace ComPHPPuebla\Fixtures\Connections;
use Doctrine\DBAL\Connection as DbConnection;
class DBALConnection implements Connection
{
/** @var DbConnection */
protected $c... |
Add <noscript> fallback to the lazyload background image example… | <?php snippet_detect('html_head', array(
'criticalcss' => 'home',
'prev_next' => false,
'prerender' => false
)); ?>
<?php snippet('banner'); ?>
<div <?php echo bgimage($page->images()->first(), array('class' => 'CoverImage FluidEmbed--3by2 FluidEmbed--large16by9 FluidEmbed--huge2by1')); ?>></div>
<div class="C... | <?php snippet_detect('html_head', array(
'criticalcss' => 'home',
'prev_next' => false,
'prerender' => false
)); ?>
<?php snippet('banner'); ?>
<div <?php echo bgimage($page->images()->first(), array('class' => 'BgImage FluidEmbed--3by2 FluidEmbed--large16by9 FluidEmbed--huge2by1')); ?>></div>
<noscript>
<div... |
Change multiple to selectbox by default | <?php
/**
* PlumSearch plugin for CakePHP Rapid Development Framework
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @author Evgeny Tomenko
* @since PlumSearch 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT Li... | <?php
/**
* PlumSearch plugin for CakePHP Rapid Development Framework
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @author Evgeny Tomenko
* @since PlumSearch 0.1
* @license http://www.opensource.org/licenses/mit-license.php MIT Li... |
Add tests into dashboard tests | <?php
class DashboardTest extends FunctionalTest
{
/**
* @dataProvider siteProvider
*/
public function testSiteTitle($siteUrl, $expectedTitle)
{
$this->url($siteUrl);
$this->assertEquals($expectedTitle, $this->title());
}
public function siteProvider()
{
retur... | <?php
class DashboardTest extends FunctionalTest
{
/**
* @dataProvider siteProvider
*/
public function testSiteTitle($siteUrl, $expectedTitle)
{
$this->url($siteUrl);
$this->assertEquals($expectedTitle, $this->title());
}
public function siteProvider()
{
retur... |
Add method to get instance. | <?php
namespace Taskforcedev\CrudApi\Helpers;
/**
* Class Model
*
* @package Taskforcedev\CrudApi\Helpers
*/
class Model
{
public $crudApi;
/**
* Model constructor.
*
* @param CrudApi $crudApi
*/
public function __construct(CrudApi $crudApi)
{
$this->crudApi = $crudApi... | <?php
namespace Taskforcedev\CrudApi\Helpers;
/**
* Class Model
*
* @package Taskforcedev\CrudApi\Helpers
*/
class Model
{
public $crudApi;
/**
* Model constructor.
*
* @param CrudApi $crudApi
*/
public function __construct(CrudApi $crudApi)
{
$this->crudApi = $crudApi... |
Remove doNotForce method as it represents the default property value already | <?php
namespace NotificationChannels\Authy;
class AuthyMessage
{
/**
* Determine whether to force the notification over cellphone network.
*
* @var bool
*/
public $force = false;
/**
* The notification method (sms/call).
*
* @var string
*/
public $method = 'sms... | <?php
namespace NotificationChannels\Authy;
class AuthyMessage
{
/**
* Determine whether to force the notification over cellphone network.
*
* @var bool
*/
public $force = false;
/**
* The notification method (sms/call).
*
* @var string
*/
public $method = 'sms... |
Change text in flash massages | <?php
namespace hipanel\actions;
use Yii;
use yii\base\Action;
class AddToCartAction extends Action
{
public $productClass;
public function run()
{
$product = new $this->productClass;
$cart = Yii::$app->cart;
$request = Yii::$app->request;
if ($product->load($request->ge... | <?php
namespace hipanel\actions;
use Yii;
use yii\base\Action;
class AddToCartAction extends Action
{
public $productClass;
public function run()
{
$product = new $this->productClass;
$cart = Yii::$app->cart;
$request = Yii::$app->request;
if ($product->load($request->ge... |
Fix assets reference at login layout | <!DOCTYPE html>
<html lang="pt-br">
<head>
@include('includes.head')
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html... | <!DOCTYPE html>
<html lang="pt-br">
<head>
@include('includes.head')
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html... |
Use inotify backend (auto detect) | <?php
namespace Kwf\FileWatcher;
use Kwf\FileWatcher\Backend as Backend;
class Watcher
{
/**
* Creates instance of best watcher backend for your system.
*/
public static function create($paths)
{
$backends = array(
new Backend\Inotifywait($paths),
new Backend\Watch... | <?php
namespace Kwf\FileWatcher;
use Kwf\FileWatcher\Backend as Backend;
class Watcher
{
/**
* Creates instance of best watcher backend for your system.
*/
public static function create($paths)
{
$backends = array(
new Backend\Inotifywait($paths),
new Backend\Watch... |
Return array consistently from query method | <?php
namespace Rogue\Services;
use Illuminate\Support\Facades\Log;
use Softonic\GraphQL\ClientBuilder;
class GraphQL
{
/**
* Build a new GraphQL client.
*/
public function __construct()
{
$this->client = ClientBuilder::build(config('services.graphql.url'));
}
/**
* Run a ... | <?php
namespace Rogue\Services;
use Illuminate\Support\Facades\Log;
use Softonic\GraphQL\ClientBuilder;
class GraphQL
{
/**
* Build a new GraphQL client.
*/
public function __construct()
{
$this->client = ClientBuilder::build(config('services.graphql.url'));
}
/**
* Run a ... |
Change action configuration amount to float | <?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\Model;
use Sylius\Component\Resource\M... | <?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\Model;
use Sylius\Component\Resource\M... |
Fix issue with /random/number where it parsed route as number | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Helpers\Helper;
class RandomController extends Controller
{
/**
* Picks a random number between min and max.
*
* @param Request $request
* @param integer $min The minimum number
* @pa... | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Helpers\Helper;
class RandomController extends Controller
{
/**
* Picks a random number between min and max.
*
* @param Request $request
* @param string $number
* @param integer $min ... |
Move the response handling to a separate method | <?php
namespace duncan3dc\Proxy;
use GuzzleHttp\Client;
class App
{
public function run(): void
{
$client = new Client([
"http_errors" => false,
]);
$url = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$response = $client->request($_SERVER["REQ... | <?php
namespace duncan3dc\Proxy;
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
class App
{
public function run(): void
{
$client = new Client([
"http_errors" => false,
]);
$url = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$r... |
Change the label sync to use a command. Make the autoloader work with a global require. | <?php
use Garden\Cli\Cli;
use Garden\Cli\Schema;
error_reporting(E_ALL); //E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
ini_set('display_errors', 'on');
ini_set('track_errors', 1);
date_default_timezone_set('America/Montreal');
require_once __DIR__.'/../vendor/autoload.ph... | <?php
use Garden\Cli\Cli;
error_reporting(E_ALL); //E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
ini_set('display_errors', 'on');
ini_set('track_errors', 1);
date_default_timezone_set('America/Montreal');
$paths = [
__DIR__.'/../vendor/autoload.php', // locally
__... |
Allow pet search to non-admins as well | <?php
add_action( 'wp_ajax_pet-search', 'pet_search' );
function pet_search() {
global $post;
$meta_query = array(
'relation' => 'AND'
);
foreach( ['sex', 'size', 'breed'] as $criterion ) {
if ( isset( $_REQUEST[$criterion] ) && $_REQUEST[$criterion] != '' ) {
$meta_query[] = array(
'key' => $criteri... | <?php
add_action( 'wp_ajax_pet-search', 'pet_search' );
add_action( 'wp_ajax_nopriv_pet-search', 'pet_search' );
function pet_search() {
global $post;
$meta_query = array(
'relation' => 'AND'
);
foreach( ['sex', 'size', 'breed'] as $criterion ) {
if ( isset( $_REQUEST[$criterion] ) && $_REQUEST[$criterion] ... |
Make $routePattern default value null | <?php
namespace Juy\ActiveMenu;
/**
* Class Active
*
* @package Juy\Providers
*/
class Active
{
/**
* Current matched route
*
* @var Route
*/
protected $currentRouteName;
/**
* Active constructor
*
* @param $currentRouteName
*/
public function __construct($... | <?php
namespace Juy\ActiveMenu;
/**
* Class Active
*
* @package Juy\Providers
*/
class Active
{
/**
* Current matched route
*
* @var Route
*/
protected $currentRouteName;
/**
* Active constructor
*
* @param $currentRouteName
*/
public function __construct($... |
Check if the DebugKit plugin is loaded before binding an event linked to it | <?php
use Cake\Core\Configure;
use Cake\Event\EventManager;
use WyriHaximus\TwigView\Event;
EventManager::instance()->on(new Event\ExtensionsListener());
EventManager::instance()->on(new Event\TokenParsersListener());
if (Configure::read('debug')) {
Configure::write('DebugKit.panels', array_merge(
(array... | <?php
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Event\EventManager;
use WyriHaximus\TwigView\Event;
EventManager::instance()->on(new Event\ExtensionsListener());
EventManager::instance()->on(new Event\TokenParsersListener());
if (Configure::read('debug') && Plugin::loaded('DebugKit')) {
Configure::... |
Fix tests for the `lowest` stability | <?php
namespace Illuminated\Testing\Tests\Asserts;
use Illuminated\Testing\Tests\App\Post;
use Illuminated\Testing\Tests\TestCase;
class DatabaseAssertsTest extends TestCase
{
/** @test */
public function it_has_database_has_table_assertion()
{
$this->assertDatabaseHasTable('posts');
}
/... | <?php
namespace Illuminated\Testing\Tests\Asserts;
use Illuminated\Testing\Tests\App\Post;
use Illuminated\Testing\Tests\TestCase;
class DatabaseAssertsTest extends TestCase
{
/** @test */
public function it_has_database_has_table_assertion()
{
$this->assertDatabaseHasTable('posts');
}
/... |
Make the base exception extend throwable | <?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Core\Exception;
/**
* Base exce... | <?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Core\Exception;
/**
* Base exce... |
Split `alert` method into two different methods | <?php
namespace TomIrons\Tuxedo\Mailables;
use TomIrons\Tuxedo\Message;
use TomIrons\Tuxedo\TuxedoMailable;
class AlertMailable extends TuxedoMailable
{
use Message;
/**
* The view to use for the message.
*
* @var string
*/
public $view = 'tuxedo::templates.alert';
/**
* Th... | <?php
namespace TomIrons\Tuxedo\Mailables;
use TomIrons\Tuxedo\Message;
use TomIrons\Tuxedo\TuxedoMailable;
class AlertMailable extends TuxedoMailable
{
use Message;
/**
* The view to use for the message.
*
* @var string
*/
public $view = 'tuxedo::templates.alert';
/**
* Th... |
Update to merge list arrays | <?php
/**
* ConfigMerge
*
* @link https://github.com/kanellov/config-merge
* @copyright Copyright (c) 2015 Vassilis Kanellopoulos - contact@kanellov.com
* @license https://raw.githubusercontent.com/kanellov/config-merge/master/LICENSE
*/
namespace Knlv;
/**
* Merges configuration arrays.
*
* Merges files in... | <?php
/**
* ConfigMerge
*
* @link https://github.com/kanellov/config-merge
* @copyright Copyright (c) 2015 Vassilis Kanellopoulos - contact@kanellov.com
* @license https://raw.githubusercontent.com/kanellov/config-merge/master/LICENSE
*/
namespace Knlv;
/**
* Merges configuration arrays.
*
* Merges files in... |
Add blank line before return statements. | <?php
namespace Github\Api;
/**
* Get rate limits
*
* @link https://developer.github.com/v3/rate_limit/
* @author Jeff Finley <quickliketurtle@gmail.com>
*/
class RateLimit extends AbstractApi
{
/**
* Get rate limits
*
* @return array
*/
public function getRateLimits()
{
... | <?php
namespace Github\Api;
/**
* Get rate limits
*
* @link https://developer.github.com/v3/rate_limit/
* @author Jeff Finley <quickliketurtle@gmail.com>
*/
class RateLimit extends AbstractApi
{
/**
* Get rate limits
*
* @return array
*/
public function getRateLimits()
{
... |
Fix saved rented space in db from string 0 to true | <?php
namespace App\Http\Controllers;
class ParkingController
{
public function get()
{
return Response::json('success', $this->table()->get());
}
public function rentSpace()
{
$id = input('id');
$this->table()->where('id', $id)->update(['rented' => true]);
retur... | <?php
namespace App\Http\Controllers;
class ParkingController
{
public function get()
{
return Response::json('success', $this->table()->get());
}
public function rentSpace()
{
$id = input('id');
$this->table()->where('id', $id)->update(['rented' => 'true']);
ret... |
Update unit tests to work with compact hash format added in d192cc4 | <?php
class HashPathExtensionTest extends PHPUnit_Framework_TestCase
{
public function testHashFile()
{
$hashPath = new HashPathExtension();
$this->assertEquals(
'2f7d9c3e0cfd47e8fcab0c12447b2bf0',
$hashPath->HashFile(
__DIR__ . '/test.txt',
... | <?php
class HashPathExtensionTest extends PHPUnit_Framework_TestCase
{
public function testHashFile()
{
$hashPath = new HashPathExtension();
$this->assertEquals(
'L32cPgz9Rj8qwwSRHsr8A',
$hashPath->HashFile(
__DIR__ . '/test.txt',
false... |
Add titles to text cards |
@card(['heading' => !$hideTitle && $post_title != "" ? $post_title : ''])
<div class="c-card__body">
{!! apply_filters('the_content', apply_filters('Modularity/Display/SanitizeContent', $post_content)) !!}
</div>
@endcard | @card()
<div class="c-card__body">
@if (!$hideTitle && !empty($post_title))
<div class="c-card__heading">
@typography([
"element" => "h2",
"variant" => "h2",
"classList" => ['c-card__heading']
])
... |
Add the Windows compatibility for the processor counter | <?php
namespace Liuggio\Fastest\Process;
/**
* Number of processors seen by the OS and used for process scheduling.
*/
class ProcessorCounter
{
const PROC_DEFAULT_NUMBER = 4;
const PROC_CPUINFO = '/proc/cpuinfo';
private static $count = null;
private $procCPUInfo;
public function __construct... | <?php
namespace Liuggio\Fastest\Process;
use Symfony\Component\Process\Process;
/**
* Number of processors seen by the OS and used for process scheduling.
*/
class ProcessorCounter
{
const PROC_DEFAULT_NUMBER = 4;
const PROC_CPUINFO = '/proc/cpuinfo';
private static $count = null;
private $procC... |
Fix Stream instance of Guzzle | <?php
namespace Gerencianet\Exception;
use Exception;
class GerencianetException extends Exception
{
private $error;
private $errorDescription;
public function __construct($exception)
{
$error = $exception;
if ($exception instanceof \GuzzleHttp\Psr7\Stream) {
$error = $... | <?php
namespace Gerencianet\Exception;
use Exception;
class GerencianetException extends Exception
{
private $error;
private $errorDescription;
public function __construct($exception)
{
$error = $exception;
if ($exception instanceof \GuzzleHttp\Stream\Stream) {
$error =... |
Add typehints to the database data collector class | <?php
namespace Common\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class DatabaseDataCollector extends DataCollector
{
private $database;
/**
* DatabaseDataCollector constructor... | <?php
namespace Common\DataCollector;
use SpoonDatabase;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class DatabaseDataCollector extends DataCollector
{
/**
* @var SpoonDatabase
*/
private... |
Revert "We shouldn’t clear history, since we’re starting a new history file." | <?php
/*
* This file is part of Psy Shell
*
* (c) 2013 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Test\Readline;
use Psy\Readline\Libedit;
class LibeditTest extends \PHPUnit_Framework_TestCase
... | <?php
/*
* This file is part of Psy Shell
*
* (c) 2013 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Test\Readline;
use Psy\Readline\Libedit;
class LibeditTest extends \PHPUnit_Framework_TestCase
... |
Add eZ repository to the migration's attribute | <?php
/**
* This file is part of the kreait eZ Publish Migrations Bundle
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Kreait\EzPublish\MigrationsBundle\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration as BaseAbs... | <?php
/**
* This file is part of the kreait eZ Publish Migrations Bundle
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Kreait\EzPublish\MigrationsBundle\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration as BaseAbs... |
Remove slashes from school name incase there are quotes or apostrophes in a school name. | <?php
require_once LIBDIR . '/testCourses.php';
require_once "stellar_lib.inc";
$selected_school_name = $_REQUEST['which'];
$schools = CourseData::get_schoolsAndCourses();
foreach($schools as $school) {
if ($school->school_name == $selected_school_name)
$courses = $school->courses;
}
$title = $selected... | <?php
require_once LIBDIR . '/testCourses.php';
require_once "stellar_lib.inc";
$selected_school_name = stripslashes($_REQUEST['which']);
$schools = CourseData::get_schoolsAndCourses();
foreach($schools as $school) {
if ($school->school_name == $selected_school_name)
$courses = $school->courses;
}
$tit... |
Document what the new option does | <?php
namespace Backend\Form\Type;
use Backend\Core\Engine\Model;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DeleteType extends AbstractType
{
pub... | <?php
namespace Backend\Form\Type;
use Backend\Core\Engine\Model;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DeleteType extends AbstractType
{
pub... |
Use assertLessThan over simple assertTrue | <?php
namespace Amp\Dns\Test;
use Amp\Dns;
use Amp\Loop;
use Amp\PHPUnit\TestCase;
use Amp\Promise;
use LibDNS\Messages\Message;
use LibDNS\Messages\MessageTypes;
use LibDNS\Records\QuestionFactory;
abstract class SocketTest extends TestCase {
abstract protected function connect(): Promise;
public function ... | <?php
namespace Amp\Dns\Test;
use Amp\Dns;
use Amp\Loop;
use Amp\PHPUnit\TestCase;
use Amp\Promise;
use LibDNS\Messages\Message;
use LibDNS\Messages\MessageTypes;
use LibDNS\Records\QuestionFactory;
abstract class SocketTest extends TestCase {
abstract protected function connect(): Promise;
public function ... |
Allow custom validation error messages to be set on models | <?php
/**
* Base model for Quill
*/
class BaseModel extends Eloquent {
protected $guarded = ['id'];
public $errors;
public function validate()
{
$v = Validator::make($this->attributes, static::$rules);
if ($v->passes()) return true;
$this->errors = $v->messages();
return false;
}
}
| <?php
/**
* Base model for Quill
*/
class BaseModel extends Eloquent {
protected $guarded = ['id'];
public $errors;
public static $messages = array();
public function validate()
{
$v = Validator::make($this->attributes, static::$rules, static::$messages);
if ($v->passes()) return true;
$this->errors =... |
Fix short syntax for arrays | <?php
/**
* CwsDumpHelper.
*
* A simple helper for CwsDump
*
* @author Cr@zy
* @copyright 2013-2016, Cr@zy
* @license GNU LESSER GENERAL PUBLIC LICENSE
*
* @link https://github.com/crazy-max/CwsDump
*/
use Cws\CwsDump;
function cwsDump($var, $echo = true)
{
$result = call_user_func([new CwsDump(), 'dump... | <?php
/**
* CwsDumpHelper.
*
* A simple helper for CwsDump
*
* @author Cr@zy
* @copyright 2013-2016, Cr@zy
* @license GNU LESSER GENERAL PUBLIC LICENSE
*
* @link https://github.com/crazy-max/CwsDump
*/
use Cws\CwsDump;
function cwsDump($var, $echo = true)
{
$result = call_user_func(array(new CwsDump(), ... |
Change fixed value in to const | <?php
namespace GusApi\Util;
use GusApi\Type\Response\SearchDataResponse;
use GusApi\Type\Response\SearchResponseCompanyData;
use GusApi\Type\Response\SearchResponseRaw;
class DataSearchDecoder
{
/**
* @param SearchResponseRaw $searchResponseRaw
*
* @return SearchDataResponse
*/
public st... | <?php
namespace GusApi\Util;
use GusApi\Type\Response\SearchDataResponse;
use GusApi\Type\Response\SearchResponseCompanyData;
use GusApi\Type\Response\SearchResponseRaw;
class DataSearchDecoder
{
/**
* @param SearchResponseRaw $searchResponseRaw
*
* @return SearchDataResponse
*/
public st... |
Add getter for server config list | <?php declare(strict_types=1);
namespace hollodotme\Readis;
use hollodotme\Readis\Application\Configs\AppConfig;
use hollodotme\Readis\Infrastructure\Redis\ServerConnection;
use hollodotme\Readis\Infrastructure\Redis\ServerManager;
use hollodotme\Readis\Interfaces\ProvidesServerConfig;
final class Env extends Abstra... | <?php declare(strict_types=1);
namespace hollodotme\Readis;
use hollodotme\Readis\Application\Configs\AppConfig;
use hollodotme\Readis\Infrastructure\Configs\ServerConfigList;
use hollodotme\Readis\Infrastructure\Interfaces\ProvidesServerConfig;
use hollodotme\Readis\Infrastructure\Interfaces\ProvidesServerConfigList... |
Convert backslash to fowardslah for unix support. | <?php
function dephendency($class) {
if (is_file(__DIR__.'/../'.$class.'.php')) {
require_once(__DIR__.'/../'.$class.'.php');
}
else {
require_once(__DIR__.'/../../../'.$class.'.php');
}
}
spl_autoload_register('dephendency');
| <?php
function dephendency($class) {
$class = str_replace("\\", '/', $class);
if (is_file(__DIR__.'/../'.$class.'.php')) {
require_once(__DIR__.'/../'.$class.'.php');
}
else {
require_once(__DIR__.'/../../../'.$class.'.php');
}
}
spl_autoload_register('dephendency');
|
Exclude policy from existing ability seeder query check | <?php
declare(strict_types=1);
namespace Cortex\Foundation\Console\Commands;
use Illuminate\Console\Command;
use Rinvex\Support\Traits\SeederHelper;
class SeedCommand extends Command
{
use SeederHelper;
/**
* The name and signature of the console command.
*
* @var string
*/
protecte... | <?php
declare(strict_types=1);
namespace Cortex\Foundation\Console\Commands;
use Illuminate\Console\Command;
use Rinvex\Support\Traits\SeederHelper;
class SeedCommand extends Command
{
use SeederHelper;
/**
* The name and signature of the console command.
*
* @var string
*/
protecte... |
Change string to check in test | <?php
/*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB... | <?php
/*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB... |
Add a test case of lazyCallbackWiring in ParameterBootstrap | <?php
namespace App\Bootstrap\Test;
use Core\ParameterWire;
use PHPUnit\Framework\TestCase;
use Core\Bootstrap\Bootstrap;
use Prob\Handler\Parameter\Named;
use Prob\Handler\ParameterMap;
use Prob\Handler\Proc\ClosureProc;
class ParameterWiringBootstrap extends TestCase
{
public function testBoot()
{
... | <?php
namespace App\Bootstrap\Test;
use Core\ParameterWire;
use Core\Utils\Parameter\Parameter;
use PHPUnit\Framework\TestCase;
use Core\Bootstrap\Bootstrap;
use Prob\Handler\Parameter\Named;
use Prob\Handler\ParameterMap;
use Prob\Handler\Proc\ClosureProc;
class ParameterWiringBootstrap extends TestCase
{
publi... |
Add date and request headers in CSP report log | <?php
class CspReport
{
public function process($post)
{
$report = json_decode($post);
if ($report) {
$report->{'user-agent'} = $_SERVER['HTTP_USER_AGENT'];
$data = json_encode(
$report,
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
... | <?php
class CspReport
{
public function process($post)
{
$report = json_decode($post);
if ($report) {
$report->date = date("Y-m-d H:i:s");
foreach (getallheaders() as $name => $value) {
$report->headers[$name] = $value;
}
$data ... |
Correct name on temporary folder | <?php
namespace staticsquish;
/**
* @license 3-clause BSD
*/
class TemporaryFolder
{
protected $folder;
public function get() {
if (!$this->folder) {
$this->folder = '/tmp/openacalendarstaticweb'.rand();
while(file_exists($this->folder)) {
$this->folder = '/tmp/openacalendarstaticweb'.... | <?php
namespace staticsquish;
/**
* @license 3-clause BSD
*/
class TemporaryFolder
{
protected $folder;
public function get() {
if (!$this->folder) {
$this->folder = '/tmp/staticsquish'.rand();
while(file_exists($this->folder)) {
$this->folder = '/tmp/staticsquish'.rand();
}
... |
Use new instance every time the facade is called | <?php
namespace Jorenvh\Share;
use Illuminate\Support\Facades\Facade;
class ShareFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return static::$app['share'];
return 'share';
... | <?php
namespace Jorenvh\Share;
use Illuminate\Support\Facades\Facade;
class ShareFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return static::$app['share'];
}
}
|
Add generating & saving APP_AUTH_KEY to setup script | <?php
namespace Northstar\Console\Commands;
use Illuminate\Console\Command;
use DFurnes\Environmentalist\ConfiguresApplication;
class SetupCommand extends Command
{
use ConfiguresApplication;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature... | <?php
namespace Northstar\Console\Commands;
use Defuse\Crypto\Key;
use Illuminate\Console\Command;
use DFurnes\Environmentalist\ConfiguresApplication;
class SetupCommand extends Command
{
use ConfiguresApplication;
/**
* The name and signature of the console command.
*
* @var string
*/
... |
Add phpstorm meta for packages | <?php
namespace Concrete\Core\Support\Symbol;
use Core;
class MetadataGenerator
{
public function render()
{
$file = '<?php namespace PHPSTORM_META { $STATIC_METHOD_TYPES = array(\\Core::make(\'\') => array(' . PHP_EOL;
$bindings = Core::getBindings();
foreach ($bindings as $name => ... | <?php
namespace Concrete\Core\Support\Symbol;
use Core;
class MetadataGenerator
{
public function render()
{
$file = '<?php namespace PHPSTORM_META { $STATIC_METHOD_TYPES = array(\\Core::make(\'\') => array(' . PHP_EOL;
$bindings = Core::getBindings();
foreach ($bindings as $name => ... |
Fix absence of variable reference | <?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\Notification\Event;
use Flarum\Notification\Blueprint\BlueprintInterface;
clas... | <?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\Notification\Event;
use Flarum\Notification\Blueprint\BlueprintInterface;
clas... |
Correct is_published check in showStory function | <?php
class IssueController extends BaseController {
protected $issue;
protected $story;
function __construct(Issue $issue, Story $story)
{
$this->issue = $issue;
$this->story = $story;
}
public function getIndex()
{
$issues = $this->issue->where('is_published', true)->orderBy('number', 'desc')->pagina... | <?php
class IssueController extends BaseController {
protected $issue;
protected $story;
function __construct(Issue $issue, Story $story)
{
$this->issue = $issue;
$this->story = $story;
}
public function getIndex()
{
$issues = $this->issue->where('is_published', true)->orderBy('number', 'desc')->pagina... |
Allow modification of the prohibited keys array, via class methods | <?php
namespace Silktide\LazyBoy\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* RestControllerTrait
*/
trait RestControllerTrait
{
private $prohibitedKeys = [
"password" => true,
"salt" => true
];
protected function success($data = null, $code = 200)
{
... | <?php
namespace Silktide\LazyBoy\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* RestControllerTrait
*/
trait RestControllerTrait
{
private $prohibitedKeys = [
"password" => true,
"salt" => true
];
protected function success($data = null, $code = 200)
{
... |
Use the Fully Qualified Namespace | <?php
namespace Hostnet\Bundle\EntityTrackerBundle\Services\Blamable;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
/**
* @covers Hostnet\Bundle\EntityTrackerBundle\Services\Blamable\DefaultBlama... | <?php
namespace Hostnet\Bundle\EntityTrackerBundle\Services\Blamable;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
/**
* @covers Hostnet\Bundle\EntityTrackerBundle\Services\Blamable\DefaultBlama... |
Fix foreign key name in relationships | <?php
namespace RadDB;
use Illuminate\Database\Eloquent\Model;
class SurveyScheduleView extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'surveyschedule_view';
/*
* Relationships
*/
public function machine()
{
... | <?php
namespace RadDB;
use Illuminate\Database\Eloquent\Model;
class SurveyScheduleView extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'surveyschedule_view';
/*
* Relationships
*/
public function machine()
{
... |
Add paste plugin and set it to remove formatting | <script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinymce.init(
{
selector: ".has_editor",
menubar: false,
plugins: [
"lists link image textcolor",
],
formats: {
forecolor: {inline: 'span', classes: 'forecolor', styles:{color: "%value"}}
},
textcolor_map: [
"0c0934",... | <script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinymce.init(
{
selector: ".has_editor",
menubar: false,
plugins: [
"lists link image textcolor paste",
],
paste_as_text: true,
formats: {
forecolor: {inline: 'span', classes: 'forecolor', styles:{color: "%value"}}
},
t... |
Fix typo in latest change for Base Controller Autoload. | <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Authenticated Controller
*
* Provides a base class for all controllers that must check user login
* status.
*
* @package Bonfire\Core\Controllers
* @category Controllers
* @author Bonfire Dev Team
* @link http://guid... | <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Authenticated Controller
*
* Provides a base class for all controllers that must check user login
* status.
*
* @package Bonfire\Core\Controllers
* @category Controllers
* @author Bonfire Dev Team
* @link http://guid... |
Refactor file type registry to use services | <?php
namespace Becklyn\AssetsBundle\File;
use Becklyn\AssetsBundle\Asset\Asset;
use Becklyn\AssetsBundle\File\Type\CssFile;
use Becklyn\AssetsBundle\File\Type\FileType;
use Becklyn\AssetsBundle\File\Type\GenericFile;
use Becklyn\AssetsBundle\File\Type\JavaScriptFile;
use Becklyn\AssetsBundle\File\Type\SvgFile;
cla... | <?php
namespace Becklyn\AssetsBundle\File;
use Becklyn\AssetsBundle\Asset\Asset;
use Becklyn\AssetsBundle\File\Type\CssFile;
use Becklyn\AssetsBundle\File\Type\FileType;
use Becklyn\AssetsBundle\File\Type\GenericFile;
use Becklyn\AssetsBundle\File\Type\JavaScriptFile;
use Becklyn\AssetsBundle\File\Type\SvgFile;
cla... |
Remove useless code from the bundle class | <?php
namespace Knplabs\Bundle\MarkdownBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;
class KnplabsMarkdownBundle extends BaseBundle
{
/**
* {@inheritdoc}
*/
public function getNamespace()
{
return __NAMESPACE__;
}
/**
* {@inheritdoc}
*/
pub... | <?php
namespace Knplabs\Bundle\MarkdownBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;
class KnplabsMarkdownBundle extends BaseBundle
{
}
|
Fix missing --no-wait option on integration:delete | <?php
namespace Platformsh\Cli\Command\Integration;
use Platformsh\Cli\Command\PlatformCommand;
use Platformsh\Cli\Util\ActivityUtil;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class IntegrationDeleteComm... | <?php
namespace Platformsh\Cli\Command\Integration;
use Platformsh\Cli\Command\PlatformCommand;
use Platformsh\Cli\Util\ActivityUtil;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class IntegrationDeleteComm... |
Return status and output from job | <?php
chdir(__DIR__ . '/../../');
if (! ZendJobQueue::getCurrentJobId()) {
header('HTTP/1.1 403 Forbidden');
exit(1);
}
$command = '/usr/local/zend/bin/php -d date.timezone=America/Chicago vendor/phly/phly-comic/bin/phly-comic.php fetch-all';
exec($command, $output, $return);
if ($return != 0) {
ZendJobQu... | <?php
chdir(__DIR__ . '/../../');
if (! ZendJobQueue::getCurrentJobId()) {
header('HTTP/1.1 403 Forbidden');
exit(1);
}
$command = '/usr/local/zend/bin/php -d date.timezone=America/Chicago vendor/phly/phly-comic/bin/phly-comic.php fetch-all';
exec($command, $output, $return);
if ($return != 0) {
ZendJobQu... |
Check for the response class | <?php
namespace Plinth\Response;
use Plinth\Dictionary;
class Parser
{
/**
* @param Response $self
* @param string $template
* @param array $templateData
* @param string $path
* @param string $tplExt
* @param Dictionary $dictionary
* @return string
*/
public st... | <?php
namespace Plinth\Response;
use Plinth\Dictionary;
class Parser
{
/**
* @param Response $self
* @param string $template
* @param array $templateData
* @param string $path
* @param string $tplExt
* @param Dictionary $dictionary
* @return string
*/
public st... |
Fix typo and use span for upgrade notice block (already nested in p tag) | <?php
/**
* Adds the WordPress plugin update action if we are on the plugins page.
*
* @since v1.1.1
*/
global $pagenow;
/**
* WordPress action for setting the upgrade notification message at the plugins page.
* @param array $plugin_data Array of plugin data.
* @param array $r Array of metada... | <?php
/**
* Adds the WordPress plugin update action if we are on the plugins page.
*
* @since v1.1.1
*/
global $pagenow;
/**
* WordPress action for setting the upgrade notification message at the plugins page.
* @param array $plugin_data Array of plugin data.
* @param array $r Array of metada... |
Add callback for compile action | <?php
namespace TlAssetsBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\Process;
class CompileCommand extends ... | <?php
namespace TlAssetsBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\Process;
class CompileCommand extends ... |
Add docblock and if statements to growl method | <?php
namespace BryanCrowe;
class Growl
{
public function __construct() {}
public function growl($message = null, $options = []) {}
public function createCommand()
{
switch (PHP_OS) {
case 'Darwin':
if (exec('which growlnotify')) {
return [
... | <?php
namespace BryanCrowe;
class Growl
{
public function __construct() {}
/**
* Options:
* - title The title
* - subtitle The subtitle
* - sticky Make it sticky. Defaults to false
*
*/
public function growl($message = null, $options = []) {
$args = $this->createCo... |
Correct bug in updating Payload with new Request object | <?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use ... | <?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use ... |
Fix notice about unititialized variable. | <?php
/* Find the authentication state. */
if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) {
throw new SimpleSAML_Error_BadRequest('Missing mandatory parameter: AuthState');
}
$authState = $_REQUEST['AuthState'];
$state = SimpleSAML_Auth_State::loadState($authState, 'openid:init');
$s... | <?php
/* Find the authentication state. */
if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) {
throw new SimpleSAML_Error_BadRequest('Missing mandatory parameter: AuthState');
}
$authState = $_REQUEST['AuthState'];
$state = SimpleSAML_Auth_State::loadState($authState, 'openid:init');
$s... |
Add cache expiration on class metadata | <?php
namespace JPC\Test\MongoDB\ODM\Factory;
use JPC\MongoDB\ODM\Factory\ClassMetadataFactory;
use JPC\Test\MongoDB\ODM\Framework\TestCase;
class ClassMetadataFactoryTest extends TestCase
{
/**
* @var ClassMetadataFactory
*/
private $classMetadataFactory;
public function setUp()
{
... | <?php
namespace JPC\Test\MongoDB\ODM\Factory;
use JPC\MongoDB\ODM\Factory\ClassMetadataFactory;
use JPC\Test\MongoDB\ODM\Framework\TestCase;
class ClassMetadataFactoryTest extends TestCase
{
/**
* @var ClassMetadataFactory
*/
private $classMetadataFactory;
public function setUp()
{
... |
Add default value to ExtraData trait | <?php
/**
* Created by PhpStorm.
* User: siciarek
* Date: 18.09.17
* Time: 13:59
*/
namespace Siciarek\SymfonyCommonBundle\Model\ExtraData;
use Doctrine\ORM\Mapping as ORM;
/**
* ExtraData trait.
*
* Should be used inside entity where you need to store some extradata (JSON serialized)
*/
trait ExtraDataProperti... | <?php
/**
* Created by PhpStorm.
* User: siciarek
* Date: 18.09.17
* Time: 13:59
*/
namespace Siciarek\SymfonyCommonBundle\Model\ExtraData;
use Doctrine\ORM\Mapping as ORM;
/**
* ExtraData trait.
*
* Should be used inside entity where you need to store some extradata (JSON serialized)
*/
trait ExtraDataProperti... |
Add ability to delete earnings from earnings' index view | @extends('layout')
@section('title', __('general.earnings'))
@section('body')
<div class="wrapper my-3">
<h2>{{ __('general.earnings') }}</h2>
<div class="box mt-3">
@if (count($earnings))
@foreach ($earnings as $earning)
<div class="box__section row... | @extends('layout')
@section('title', __('general.earnings'))
@section('body')
<div class="wrapper my-3">
<h2>{{ __('general.earnings') }}</h2>
<div class="box mt-3">
@if (count($earnings))
@foreach ($earnings as $earning)
<div class="box__section row... |
Handle null being passed to getUserById | <?php
namespace Hackzilla\Bundle\TicketBundle\Manager;
use Doctrine\ORM\EntityRepository;
use Hackzilla\Bundle\TicketBundle\Model\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
class UserManager implements UserManagerInterface
{
private $tokenStorage;
private $u... | <?php
namespace Hackzilla\Bundle\TicketBundle\Manager;
use Doctrine\ORM\EntityRepository;
use Hackzilla\Bundle\TicketBundle\Model\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
class UserManager implements UserManagerInterface
{
private $tokenStorage;
private $u... |
Create the file if it doesn't exist | <?php
namespace Typidesign\Translations\Console\Commands;
class AddTranslations extends AbstractTranslations
{
/**
* The name and signature of the console command.
*/
protected $signature = 'translations:add
{path : The file or directory containing the json encoded translations you want to m... | <?php
namespace Typidesign\Translations\Console\Commands;
class AddTranslations extends AbstractTranslations
{
/**
* The name and signature of the console command.
*/
protected $signature = 'translations:add
{path : The file or directory containing the json encoded translations you want to m... |
Fix Answer Admin listing and adding/editing | <?php
// src/Effi/QCMBundle/Admin/AnswerAdmin.php
namespace Effi\QCMBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class AnswerAdmin extends Admin
{
// FORMULAIRE EDITION AJOUT
... | <?php
// src/Effi/QCMBundle/Admin/AnswerAdmin.php
namespace Effi\QCMBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class AnswerAdmin extends Admin
{
// FORMULAIRE EDITION AJOUT
... |
Fix missing quote mark on the title | <img class="logo" title="Laravel Logo" alt="Laravel Logo" src="img/laravel.svg">
<span class="social-icons">
<a href="{{ $meetup_url }}" title="Link to the Laravel Brussels group on Meetup.com>
<i class=" fa fa-3x fa-meetup" aria-hidden="true"></i>
</a>
<a href="//twitter.com/{{ $twitter }}" title="... | <img class="logo" title="Laravel Logo" alt="Laravel Logo" src="img/laravel.svg">
<span class="social-icons">
<a href="{{ $meetup_url }}" title="Link to the Laravel Brussels group on Meetup.com">
<i class=" fa fa-3x fa-meetup" aria-hidden="true"></i>
</a>
<a href="//twitter.com/{{ $twitter }}" title=... |
Use local date instead of a sql function (tests are in sqlite, base in mysql) | <?php
namespace App;
use App\Casts\EncryptedString;
use DateInterval;
use DateTime;
use DB;
use Illuminate\Database\Eloquent\Model;
class Draw extends Model
{
use HashId;
protected static $hashConnection = 'draw';
/**
* The attributes that should be cast.
*
* @var array
*/
prote... | <?php
namespace App;
use App\Casts\EncryptedString;
use DateInterval;
use DateTime;
use DB;
use Illuminate\Database\Eloquent\Model;
class Draw extends Model
{
use HashId;
protected static $hashConnection = 'draw';
/**
* The attributes that should be cast.
*
* @var array
*/
prote... |
Fix for the `me` action | <?php
/**
* CakeManager (http://cakemanager.org)
* Copyright (c) http://cakemanager.org
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) http://cakemanag... | <?php
/**
* CakeManager (http://cakemanager.org)
* Copyright (c) http://cakemanager.org
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) http://cakemanag... |
Order roles in the guild relationship | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Guild extends Model
{
use SoftDeletes;
protected $table = "guild";
public $incrementing = false;
protected $with = [
'settings'
];
public function settings()
... | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Guild extends Model
{
use SoftDeletes;
protected $table = "guild";
public $incrementing = false;
protected $with = [
'settings'
];
public function settings()
... |
Remove a very old Herald garbage collection migration | <?php
echo pht('Cleaning up old Herald rule applied rows...')."\n";
$table = new HeraldRule();
$table->openTransaction();
$table->beginReadLocking();
$rules = $table->loadAll();
foreach ($rules as $key => $rule) {
$first_policy = HeraldRepetitionPolicyConfig::toInt(
HeraldRepetitionPolicyConfig::FIRST);
if ($... | <?php
// Once, this migration deleted some unnecessary rows written by Herald before
// January 2012. These rows don't hurt anything, they just cluttered up the
// database a bit.
// The migration was removed in January 2018 to make maintenance on rule
// repetition policies easier.
|
Add function for fetching contacts relations | <?php
namespace Bexio;
class Bexio
{
private $client;
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* Gets all the contacts
*
* @return array
*/
public function getContacts(array $params = [])
{
return $this->client->get(... | <?php
namespace Bexio;
class Bexio
{
private $client;
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* Gets all the contacts
*
* @return array
*/
public function getContacts(array $params = [])
{
return $this->client->get(... |
Fix auth redirect for non-rooted applications | <?php
namespace Beskhue\CookieTokenAuth\Controller\Component;
use Cake\Controller\Component;
use Cake\Routing\Router;
/**
* Redirect component.
*/
class RedirectComponent extends Component
{
public $components = ['Auth'];
/**
* Initialize properties.
*
* @param array $config The config ... | <?php
namespace Beskhue\CookieTokenAuth\Controller\Component;
use Cake\Controller\Component;
use Cake\Routing\Router;
/**
* Redirect component.
*/
class RedirectComponent extends Component
{
public $components = ['Auth'];
/**
* Initialize properties.
*
* @param array $config The config ... |
Add $useAutoIncrement property to model template | <@php
namespace {namespace};
use CodeIgniter\Model;
class {class} extends Model
{
protected $table = '{table}';
protected $primaryKey = 'id';
protected $insertID = 0;
protected $DBGroup = '{dbgroup}';
protected $returnType = '{return}';
protected $useSoftDeletes = false;
protected $allowedFields ... | <@php
namespace {namespace};
use CodeIgniter\Model;
class {class} extends Model
{
protected $table = '{table}';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $insertID = 0;
protected $DBGroup = '{dbgroup}';
protected $returnType = '{return}';
protected $useSoftDeletes... |
Extend dbxref mapping service to work with arbitrary dbs | <?php
namespace AppBundle\API\Mapping;
use AppBundle\API\Webservice;
use AppBundle\User\FennecUser;
use Symfony\Component\HttpFoundation\ParameterBag;
class ByDbxrefId extends Webservice
{
private $db;
/**
* @inheritdoc
*/
public function execute(ParameterBag $query, FennecUser $user = null)
... | <?php
namespace AppBundle\API\Mapping;
use AppBundle\API\Webservice;
use AppBundle\User\FennecUser;
use Symfony\Component\HttpFoundation\ParameterBag;
class ByDbxrefId extends Webservice
{
private $db;
/**
* @inheritdoc
*/
public function execute(ParameterBag $query, FennecUser $user = null)
... |
Add loading spinner to the podcast details pane | <div id="podcast-details" class="sidebar-content" ng-controller="PodcastDetailsController" ng-if="contentType=='podcastChannel' || contentType=='podcastEpisode'">
<div class="albumart clickable" ng-show="details.image" ng-click="scrollToEntity(contentType, entity)"></div>
<dl class="tags">
<dt ng-repeat-start="(... | <div id="podcast-details" class="sidebar-content" ng-controller="PodcastDetailsController" ng-if="contentType=='podcastChannel' || contentType=='podcastEpisode'">
<div class="albumart clickable" ng-show="details.image" ng-click="scrollToEntity(contentType, entity)"></div>
<dl class="tags" ng-show="details">
<dt ... |
Add unit test which use the mongodb session backend | <?php
use \photon\config\Container as Conf;
class SessionTest extends \photon\test\TestCase
{
protected $conf;
public function setup()
{
parent::setup();
Conf::set('session_storage', '\photon\session\storage\MongoDB');
}
public function testEmptySession()
{
$req = \ph... | <?php
use \photon\config\Container as Conf;
class SessionTest extends \photon\test\TestCase
{
protected $conf;
public function setup()
{
parent::setup();
Conf::set('session_storage', '\photon\session\storage\MongoDB');
}
public function testEmptySession()
{
$req = \ph... |
Make it so routes can echo their output | <?php
namespace Concrete\Core\Routing;
use Concrete\Core\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
class ClosureRouteAction implements RouteActionInterface
{
protected $callback;
/**
* ClosureRouteAction constructor.
... | <?php
namespace Concrete\Core\Routing;
use Concrete\Core\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
class ClosureRouteAction implements RouteActionInterface
{
protected $callback;
/**
* ClosureRouteAction constructor.
... |
Fix whitespace at the end of the URL breaking routing | <?php
require __DIR__.'/../includes/init.php';
use App\RegExp;
use App\HTTP;
use App\Users;
use App\CoreUtils;
$permRedirectPattern = new RegExp('^\s*(.*?)\.php(\?.*)?$','i');
if (preg_match($permRedirectPattern, $_SERVER['REQUEST_URI']))
HTTP::redirect(preg_replace($permRedirectPattern, '$1$2', $_SERVER['R... | <?php
require __DIR__.'/../includes/init.php';
use App\RegExp;
use App\HTTP;
use App\Users;
use App\CoreUtils;
$permRedirectPattern = new RegExp('^\s*(.*?)\.php(\?.*)?$','i');
if (preg_match($permRedirectPattern, $_SERVER['REQUEST_URI']))
HTTP::redirect(preg_replace($permRedirectPattern, '$1$2', $_SERVER['R... |
Make buttons of person links | @extends('layouts.offcanvas')
@section('sidebar')
@endsection
@section('main')
<div id="tribe-details">
<h2>@lang("ui.about")</h2>
{{ link_to_action('FriendsController@getGoals', trans('ui.goals.title_index'), $d->id) }}
{{ link_to_action('FriendsController@getEndorsements', trans('ui.endorsements.title_index')... | @extends('layouts.offcanvas')
@section('sidebar')
@endsection
@section('main')
<div id="tribe-details">
<h2>@lang("ui.about")</h2>
{{ link_to_action('FriendsController@getGoals', trans('ui.goals.title_index'), $d->id, array('class' => 'button small')) }}
{{ link_to_action('FriendsController@getEndorsements', tr... |
Update lifetime sales value calculation - Fix issue with constant removal | <?php
namespace Oro\Bundle\CurrencyBundle\Rounding;
class PriceRoundingService extends AbstractRoundingService
{
const DEFAULT_ROUND_TYPE = RoundingServiceInterface::ROUND_HALF_UP;
const DEFAULT_PRECISION = 2;
/** {@inheritdoc} */
public function getRoundType()
{
return self::DEFAULT_ROU... | <?php
namespace Oro\Bundle\CurrencyBundle\Rounding;
use Oro\DBAL\Types\MoneyType;
class PriceRoundingService extends AbstractRoundingService
{
const FALLBACK_PRECISION = MoneyType::TYPE_SCALE;
const DEFAULT_ROUND_TYPE = RoundingServiceInterface::ROUND_HALF_UP;
const DEFAULT_PRECISION = 2;
/** {@inh... |
Make header dashboard link go to the right place | <nav class="nav has-shadow">
<div class="container is-fluid">
<div class="nav-left">
<a href="{{ route('helpdesk.dashboard.agent') }}" class="nav-item is-tab @if(isset($tab) && $tab == 'dashboard') is-active @endif">
Dashboard
</a>
</div>
<div class="nav-center">
<a class="nav-i... | <nav class="nav has-shadow">
<div class="container is-fluid">
<div class="nav-left">
<a href="{{ route('helpdesk.dashboard.router') }}" class="nav-item is-tab @if(isset($tab) && $tab == 'dashboard') is-active @endif">
Dashboard
</a>
</div>
<div class="nav-center">
<a class="nav-... |
Add 'open/close' option for Nikoswitch (used as Shutter) | <?php
namespace Autohome\Plugins\Niko;
class SwitchPlugin extends NikoPlugin
{
protected $values = [
'on' => 1, '254' => 1,
'off' => 0, '255' => 0,
];
}
| <?php
namespace Autohome\Plugins\Niko;
class SwitchPlugin extends NikoPlugin
{
protected $values = [
'on' => 1, 'open' => 1, '254' => 1,
'off' => 0, 'close' => 0, '255' => 0,
];
}
|
Correct PHPDoc type for float ttl | <?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\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\L... | <?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\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\L... |
Add the method for user to delete a notification or clear them all. | <?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Notification;
use Illuminate\Http\Request;
class NotificationsController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$notificatio... | <?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Notification;
use Illuminate\Http\Request;
class NotificationsController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$notificatio... |
Update gearman client call due to changes | <?php
namespace Soil\QueueHttpEndpointBundle\Controller;
use Soilby\EventComponent\Service\GearmanClient;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
/**
* Created by PhpStorm.
* User: fliak
* Date: 5.2.15
* Time: 15.14
*/
class EndpointController {
/**... | <?php
namespace Soil\QueueHttpEndpointBundle\Controller;
use Soilby\EventComponent\Service\GearmanClient;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
/**
* Created by PhpStorm.
* User: fliak
* Date: 5.2.15
* Time: 15.14
*/
class EndpointController {
/**... |
Remove return Reminder object from createReminder | <?php
namespace CalendarReminder;
interface ReminderRepository
{
/**
* @param string $date
* @param string $content
* @return Reminder
*/
public function createReminder(string $date, string $content): Reminder;
/**
* @param Reminder $reminder
*/
public function save(Remi... | <?php
namespace CalendarReminder;
interface ReminderRepository
{
/**
* @param string $date
* @param string $content
*/
public function createReminder(string $date, string $content);
/**
* @param Reminder $reminder
*/
public function save(Reminder $reminder);
} |
Disable error messages for production. | <?php
ini_set('display_errors', '1');
error_reporting(E_ALL);
require_once dirname(__FILE__).'/system/Application.php';
Application::run();
?>
| <?php
// ini_set('display_errors', '1');
// error_reporting(E_ALL);
require_once dirname(__FILE__).'/system/Application.php';
Application::run();
?>
|
Use proper namespace prefix for ldp | <?php
require_once "vendor/autoload.php";
$valid_types = [
"text/turtle" => "turtle",
"application/ld+json" => "jsonld",
"application/n-triples" => "ntriples"];
$format = "text/turtle";
foreach (getallheaders() as $key => $val) {
if (strtolower($key) === "accept") {
$type = explode(";", $val... | <?php
require_once "vendor/autoload.php";
$LDP = "http://www.w3.org/ns/ldp#";
$valid_types = [
"text/turtle" => "turtle",
"application/ld+json" => "jsonld",
"application/n-triples" => "ntriples"];
$format = "text/turtle";
foreach (getallheaders() as $key => $val) {
if (strtolower($key) === "accept"... |
Return types in manager tests | <?php
/*
* WellCommerce Open-Source E-Commerce Platform
*
* This file is part of the WellCommerce package.
*
* (c) Adam Piotrowski <adam@wellcommerce.org>
*
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
*/
namespace WellCommerce\... | <?php
/*
* WellCommerce Open-Source E-Commerce Platform
*
* This file is part of the WellCommerce package.
*
* (c) Adam Piotrowski <adam@wellcommerce.org>
*
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
*/
namespace WellCommerce\... |
Use bin/node instead of node | <?php
class Kwf_Trl_Parser_JsParser
{
public static function parseContent($content)
{
$cmd = 'node '.__DIR__.'/JsParser.js '.escapeshellarg($content);
exec($cmd, $cmdOutput, $retVal);
if ($retVal) {
throw new Kwf_Exception("Parsing js file failed: $content".implode("\n", $cmd... | <?php
class Kwf_Trl_Parser_JsParser
{
public static function parseContent($content)
{
$cmd = getcwd().'/'.VENDOR_PATH.'/bin/node '.__DIR__.'/JsParser.js '.escapeshellarg($content);
exec($cmd, $cmdOutput, $retVal);
if ($retVal) {
throw new Kwf_Exception("Parsing js file failed... |
Fix mailchimp test which depends on how many people are on our mailchimp testing list | <?php
require_once('tests/php/base.php');
class CashSeedTests extends UnitTestCase {
function testS3Seed(){
$settings = new S3Seed(1,1);
$this->assertIsa($settings, 'S3Seed');
}
function testTwitterSeed(){
$user_id = 1;
$settings_id = 1;
$twitter = new TwitterSeed($user_id,$settings_id);
$th... | <?php
require_once('tests/php/base.php');
class CashSeedTests extends UnitTestCase {
function testS3Seed(){
$settings = new S3Seed(1,1);
$this->assertIsa($settings, 'S3Seed');
}
function testTwitterSeed(){
$user_id = 1;
$settings_id = 1;
$twitter = new TwitterSeed($user_id,$settings_id);
$th... |
Remove unused link to cookie.js update SVN external | <?php
function get_nested_set_manager($model, $field, $root = 0){
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/jsTree/themes/default/style.css');
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/css/screen... | <?php
function get_nested_set_manager($model, $field, $root = 0){
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/jsTree/themes/default/style.css');
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/css/screen... |
Change path instead of dbName for SQLite driver | <?php
namespace Liuggio\Fastest\Doctrine\DBAL;
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory as BaseConnectionFactory;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Liuggio\Fastest\Process\EnvCommandCreator;
/**
* Creates a connection taking the db name from the env, this is great if... | <?php
namespace Liuggio\Fastest\Doctrine\DBAL;
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory as BaseConnectionFactory;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Liuggio\Fastest\Process\EnvCommandCreator;
/**
* Creates a connection taking the db name from the env, this is great if... |
Revert "translate via api call" | <?php
/**
* Created by IntelliJ IDEA.
* User: nikolayyotsov
* Date: 5/21/17
* Time: 3:40 PM
*/
namespace App\Http\Controllers;
use App\Http\Client\TransltrClient;
use App\Word;
use Illuminate\Http\Request;
class TranslateController extends Controller
{
/**
* @var array
*/
private $validationRu... | <?php
/**
* Created by IntelliJ IDEA.
* User: nikolayyotsov
* Date: 5/21/17
* Time: 3:40 PM
*/
namespace App\Http\Controllers;
use App\Word;
use Illuminate\Http\Request;
class TranslateController extends Controller
{
/**
* @var array
*/
private $validationRules
= [
'words' ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.