Commit 7e7b1642 by abalsh

Merge branch 'revert-f5cc237d' into 'laravel'

Revert "Crypto Backend Finished"

See merge request !1
parents 7dcfa260 781f2429
Showing with 492 additions and 815 deletions
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class updatecrypto extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$client = new \GuzzleHttp\Client([
'headers' => [
'X-CMC_PRO_API_KEY' => env("CMC_API_KEY", null),
'Accept-Encoding' => 'deflate, gzip'
]
]);
$res = $client->request('GET', 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest', [
'query' => [
'limit' => '100',
'convert' => 'EUR'
],
'Filter' => ['data']
]);
//$res->getStatusCode();
$result = json_decode($res->getBody(),true);
DB::beginTransaction();
foreach($result["data"] as $item) {
DB::table('crypto')
->updateOrInsert(
['name' => $item["name"], 'symbol' => $item["symbol"]],
['rate' => $item["quote"]["EUR"]["price"]]
);
}
DB::commit();
}
}
......@@ -6,20 +6,8 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\DB;
class Controller extends BaseController
{
public function convert($convertFrom,$convertFromValue,$convertTo)
{
$dbCryptoTable = 'crypto';
$convertFromRate = DB::table($dbCryptoTable)->where('symbol', $convertFrom)->value('rate');
$convertToRate = DB::table($dbCryptoTable)->where('symbol', $convertTo)->value('rate');
if ($convertFromRate && $convertToRate) {
$converted = ($convertFromRate * $convertFromValue) / $convertToRate;
return $converted;
} else {
return NULL;
}
}
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
......@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Spatie\Newsletter\NewsletterFacade as Newsletter;
use Spatie\Newsletter\Newsletter;
class NewsLetterController extends Controller
{
......
......@@ -9,11 +9,10 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"spatie/laravel-newsletter": "^4.4"
"spatie/laravel-newsletter": "^4.3"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
......
<?php
return [
/*
* The API key of a MailChimp account. You can find yours at
* https://us10.admin.mailchimp.com/account/api-key-popup/.
*/
'apiKey' => env('MAILCHIMP_APIKEY'),
/*
* The listName to use when no listName has been specified in a method.
*/
'defaultListName' => 'subscribers',
/*
* Here you can define properties of the lists.
*/
'lists' => [
/*
* This key is used to identify this list. It can be used
* as the listName parameter provided in the various methods.
*
* You can set it to any string you want and you can add
* as many lists as you want.
*/
'subscribers' => [
/*
* A MailChimp list id. Check the MailChimp docs if you don't know
* how to get this value:
* http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id.
*/
'id' => env('MAILCHIMP_LIST_ID'),
],
],
/*
* If you're having trouble with https connections, set this to false.
*/
'ssl' => true,
];
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCryptoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('crypto', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('symbol',100);
$table->string('name',100);
$table->double('rate');
$table->timestamp('updated_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('crypto');
}
}
......@@ -36,12 +36,12 @@
<div class="card card-3">
<div class="card-heading"></div>
<div class="card-body">
@if (session('success'))
@if (Session::has('success'))
<div class="alert alert-success" role="alert">
{{ session('success') }}
</div>
@endif
@if (session('failure'))
@if (Session::has('failure'))
<div class="alert alert-danger" role="alert">
{{ session('failure') }}
</div>
......
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Composer
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
Source: https://github.com/composer/composer
Files: *
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
License: Expat
Copyright (c) Nils Adermann, Jordi Boggiano
Files: src/Composer/Util/TlsHelper.php
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
2013, Evan Coury <me@evancoury.com>
License: Expat and BSD-2-Clause
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
License: BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
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
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
......@@ -50,10 +50,7 @@ return array(
'DrewM\\MailChimp\\' => array($vendorDir . '/drewm/mailchimp-api/src'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'),
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/lib/Doctrine/Common'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Cron\\' => array($vendorDir . '/dragonmantank/cron-expression/src/Cron'),
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
......
......@@ -20,7 +20,7 @@ Laravel is a web application framework with expressive, elegant syntax. We belie
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked.
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked
## Learning Laravel
......
......@@ -527,6 +527,7 @@ class Gate implements GateContract
}
return function () {
return null;
};
}
......@@ -652,7 +653,7 @@ class Gate implements GateContract
protected function callPolicyBefore($policy, $user, $ability, $arguments)
{
if (! method_exists($policy, 'before')) {
return;
return null;
}
if ($this->canBeCalledWithUser($user, $policy, 'before')) {
......@@ -679,7 +680,7 @@ class Gate implements GateContract
}
if (! is_callable([$policy, $method])) {
return;
return null;
}
if ($this->canBeCalledWithUser($user, $policy, $method)) {
......
......@@ -74,11 +74,11 @@ class AuthMakeCommand extends Command
*/
protected function createDirectories()
{
if (! is_dir($directory = $this->getViewPath('layouts'))) {
if (! is_dir($directory = resource_path('views/layouts'))) {
mkdir($directory, 0755, true);
}
if (! is_dir($directory = $this->getViewPath('auth/passwords'))) {
if (! is_dir($directory = resource_path('views/auth/passwords'))) {
mkdir($directory, 0755, true);
}
}
......@@ -91,7 +91,7 @@ class AuthMakeCommand extends Command
protected function exportViews()
{
foreach ($this->views as $key => $value) {
if (file_exists($view = $this->getViewPath($value)) && ! $this->option('force')) {
if (file_exists($view = resource_path('views/'.$value)) && ! $this->option('force')) {
if (! $this->confirm("The [{$value}] view already exists. Do you want to replace it?")) {
continue;
}
......@@ -117,16 +117,4 @@ class AuthMakeCommand extends Command
file_get_contents(__DIR__.'/stubs/make/controllers/HomeController.stub')
);
}
/**
* Get full view path relative to the app's configured view path.
*
* @return string
*/
protected function getViewPath($path)
{
return implode(DIRECTORY_SEPARATOR, [
config('view.paths')[0] ?? resource_path('views'), $path,
]);
}
}
......@@ -15,13 +15,13 @@
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('email') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......@@ -29,13 +29,13 @@
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required autocomplete="current-password">
@error('password')
@if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('password') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......
......@@ -21,13 +21,13 @@
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('email') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......
......@@ -17,13 +17,13 @@
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@error('email')
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('email') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......@@ -31,13 +31,13 @@
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required autocomplete="new-password">
@error('password')
@if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('password') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......
......@@ -15,13 +15,13 @@
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
@if ($errors->has('name'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('name') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......@@ -29,13 +29,13 @@
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('email') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......@@ -43,13 +43,13 @@
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required autocomplete="new-password">
@error('password')
@if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
<strong>{{ $errors->first('password') }}</strong>
</span>
@enderror
@endif
</div>
</div>
......
......@@ -68,7 +68,7 @@ class EloquentUserProvider implements UserProvider
)->first();
if (! $retrievedModel) {
return;
return null;
}
$rememberToken = $retrievedModel->getRememberToken();
......
......@@ -46,7 +46,9 @@ class PasswordBrokerManager implements FactoryContract
{
$name = $name ?: $this->getDefaultDriver();
return $this->brokers[$name] ?? ($this->brokers[$name] = $this->resolve($name));
return isset($this->brokers[$name])
? $this->brokers[$name]
: $this->brokers[$name] = $this->resolve($name);
}
/**
......
......@@ -550,10 +550,7 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
$attribute => Hash::make($password),
]))->save();
if ($this->recaller() ||
$this->getCookieJar()->hasQueued($this->getRecallerName())) {
$this->queueRecallerCookie($this->user());
}
$this->queueRecallerCookie($this->user());
$this->fireOtherDeviceLogoutEvent($this->user());
......
......@@ -294,6 +294,8 @@ abstract class Broadcaster implements BroadcasterContract
return $user;
}
}
return null;
}
/**
......
......@@ -24,7 +24,7 @@ class ArrayStore extends TaggableStore
public function get($key)
{
if (! isset($this->storage[$key])) {
return;
return null;
}
$item = $this->storage[$key];
......@@ -34,7 +34,7 @@ class ArrayStore extends TaggableStore
if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) {
$this->forget($key);
return;
return null;
}
return $item['value'];
......
......@@ -151,6 +151,7 @@ class DynamoDbStore implements Store, LockProvider
$now = Carbon::now();
return array_merge(collect(array_flip($keys))->map(function () {
return null;
})->all(), collect($response['Responses'][$this->table])->mapWithKeys(function ($response) use ($now) {
if ($this->isExpired($response, $now)) {
$value = null;
......
......@@ -21,6 +21,7 @@ class NullStore extends TaggableStore
*/
public function get($key)
{
return null;
}
/**
......
......@@ -546,7 +546,11 @@ class Container implements ArrayAccess, ContainerContract
*/
protected function getReboundCallbacks($abstract)
{
return $this->reboundCallbacks[$abstract] ?? [];
if (isset($this->reboundCallbacks[$abstract])) {
return $this->reboundCallbacks[$abstract];
}
return [];
}
/**
......@@ -1118,7 +1122,11 @@ class Container implements ArrayAccess, ContainerContract
{
$abstract = $this->getAlias($abstract);
return $this->extenders[$abstract] ?? [];
if (isset($this->extenders[$abstract])) {
return $this->extenders[$abstract];
}
return [];
}
/**
......
......@@ -15,7 +15,7 @@ interface UserProvider
/**
* Retrieve a user by their unique identifier and "remember me" token.
*
* @param mixed $identifier
* @param mixed $identifier
* @param string $token
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
......
......@@ -1118,7 +1118,7 @@ class Connection implements ConnectionInterface
}
/**
* Determine if the connection is in a "dry run".
* Determine if the connection in a "dry run".
*
* @return bool
*/
......
......@@ -151,8 +151,7 @@ class DatabaseManager implements ConnectionResolverInterface
throw new InvalidArgumentException("Database [{$name}] not configured.");
}
return (new ConfigurationUrlParser)
->parseConfiguration($config);
return $config;
}
/**
......
......@@ -141,7 +141,7 @@ class Collection extends BaseCollection implements QueueableCollection
* @param array $path
* @return void
*/
protected function loadMissingRelation(self $models, array $path)
protected function loadMissingRelation(Collection $models, array $path)
{
$relation = array_shift($path);
......
......@@ -50,7 +50,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
protected $primaryKey = 'id';
/**
* The "type" of the primary key ID.
* The "type" of the auto-incrementing ID.
*
* @var string
*/
......@@ -1287,7 +1287,9 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
*/
public function getTable()
{
return $this->table ?? Str::snake(Str::pluralStudly(class_basename($this)));
return isset($this->table)
? $this->table
: Str::snake(Str::pluralStudly(class_basename($this)));
}
/**
......
......@@ -214,7 +214,7 @@ trait InteractsWithPivotTable
protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch)
{
$updated = $this->newPivot([
$this->foreignPivotKey => $this->parent->{$this->parentKey},
$this->foreignPivotKey => $this->parent->getKey(),
$this->relatedPivotKey => $this->parseId($id),
], true)->fill($attributes)->save();
......@@ -446,7 +446,7 @@ trait InteractsWithPivotTable
foreach ($this->parseIds($ids) as $id) {
$results += $this->newPivot([
$this->foreignPivotKey => $this->parent->{$this->parentKey},
$this->foreignPivotKey => $this->parent->getKey(),
$this->relatedPivotKey => $id,
], true)->delete();
}
......
......@@ -2,12 +2,6 @@
namespace Illuminate\Database\Eloquent;
/**
* @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed()
* @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder onlyTrashed()
* @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withoutTrashed()
* @method bool restore()
*/
trait SoftDeletes
{
/**
......
......@@ -580,7 +580,7 @@ class Migrator
}
/**
* Write a note to the console's output.
* Write a note to the conosle's output.
*
* @param string $message
* @return void
......
......@@ -2979,26 +2979,6 @@ class Builder
}
/**
* Dump the current SQL and bindings.
*
* @return void
*/
public function dump()
{
dump($this->toSql(), $this->getBindings());
}
/**
* Die and dump the current SQL and bindings.
*
* @return void
*/
public function dd()
{
dd($this->toSql(), $this->getBindings());
}
/**
* Handle dynamic method calls into the method.
*
* @param string $method
......
......@@ -733,7 +733,9 @@ class Grammar extends BaseGrammar
protected function compileOrdersToArray(Builder $query, $orders)
{
return array_map(function ($order) {
return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction'];
return ! isset($order['sql'])
? $this->wrap($order['column']).' '.$order['direction']
: $order['sql'];
}, $orders);
}
......
......@@ -2,11 +2,27 @@
namespace Illuminate\Database\Schema;
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Types\TinyInteger;
class MySqlBuilder extends Builder
{
/**
* Create a new builder instance.
*
* @param \Illuminate\Database\Connection $connection
* @return void
*
* @throws \Doctrine\DBAL\DBALException
*/
public function __construct(Connection $connection)
{
parent::__construct($connection);
$this->registerCustomDoctrineTypes();
}
/**
* Determine if the given table exists.
*
* @param string $table
......
......@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.8.15';
const VERSION = '5.8.13';
/**
* The base path for the Laravel installation.
......
......@@ -31,7 +31,7 @@ trait SendsPasswordResetEmails
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$this->credentials($request)
$request->only('email')
);
return $response == Password::RESET_LINK_SENT
......@@ -51,17 +51,6 @@ trait SendsPasswordResetEmails
}
/**
* Get the needed authentication credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function credentials(Request $request)
{
return $request->only('email');
}
/**
* Get the response for a successful password reset link.
*
* @param \Illuminate\Http\Request $request
......
// Body
$body-bg: #f8fafc;
// Typography
$font-family-sans-serif: 'Nunito', sans-serif;
$font-family-sans-serif: "Nunito", sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
......@@ -10,7 +11,7 @@ $line-height-base: 1.6;
$blue: #3490dc;
$indigo: #6574cd;
$purple: #9561e2;
$pink: #f66d9b;
$pink: #f66D9b;
$red: #e3342f;
$orange: #f6993f;
$yellow: #ffed4a;
......
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
......@@ -8,6 +9,6 @@
@import '~bootstrap/scss/bootstrap';
.navbar-laravel {
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
/**
* First, we will load all of this project's Javascript utilities and other
* dependencies. Then, we will be ready to develop a robust and powerful
......
......@@ -10,7 +10,9 @@ export default class Example extends Component {
<div className="card">
<div className="card-header">Example Component</div>
<div className="card-body">I'm an example component!</div>
<div className="card-body">
I'm an example component!
</div>
</div>
</div>
</div>
......
/**
* First we will load all of this project's JavaScript dependencies which
* includes React and other helpers. It's a great starting point while
......
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
......@@ -28,5 +29,5 @@ Vue.component('example-component', require('./components/ExampleComponent.vue').
*/
const app = new Vue({
el: '#app',
el: '#app'
});
......@@ -79,7 +79,7 @@ class VerifyCsrfToken
});
}
throw new TokenMismatchException('CSRF token mismatch.');
throw new TokenMismatchException;
}
/**
......
......@@ -915,7 +915,7 @@ class TestResponse
$keys = (array) $keys;
if (empty($keys)) {
return $this->assertSessionHasNoErrors();
return $this->assertSessionMissing('errors');
}
if (is_null($this->session()->get('errors'))) {
......
......@@ -167,7 +167,7 @@ trait ConditionallyLoadsAttributes
}
if ($this->resource->{$relationship} === null) {
return;
return null;
}
return value($value);
......
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank">{{ $slot }}</a>
......
<tr>
<td>
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0">
<tr>
<td class="content-cell" align="center">
{{ Illuminate\Mail\Markdown::parse($slot) }}
......
......@@ -23,16 +23,16 @@
}
</style>
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="content" width="100%" cellpadding="0" cellspacing="0">
{{ $header ?? '' }}
<!-- Email Body -->
<tr>
<td class="body" width="100%" cellpadding="0" cellspacing="0">
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0">
<!-- Body content -->
<tr>
<td class="content-cell">
......
<table class="panel" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="panel" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="panel-content">
<table width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="panel-item">
{{ Illuminate\Mail\Markdown::parse($slot) }}
......
<table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
{{ Illuminate\Mail\Markdown::parse($slot) }}
......
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="{{ $url }}" class="button button-green" target="_blank">{{ $slot }}</a>
......
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
{{ Illuminate\Mail\Markdown::parse($slot) }}
......
/* Base */
body,
body *:not(html):not(style):not(br):not(tr):not(code) {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
body, body *:not(html):not(style):not(br):not(tr):not(code) {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
box-sizing: border-box;
}
body {
background-color: #f8fafc;
color: #74787e;
background-color: #F8FAFC;
color: #74787E;
height: 100%;
hyphens: auto;
line-height: 1.4;
......@@ -32,7 +30,7 @@ blockquote {
}
a {
color: #3869d4;
color: #3869D4;
}
a img {
......@@ -42,7 +40,7 @@ a img {
/* Typography */
h1 {
color: #3d4852;
color: #3D4852;
font-size: 19px;
font-weight: bold;
margin-top: 0;
......@@ -50,7 +48,7 @@ h1 {
}
h2 {
color: #3d4852;
color: #3D4852;
font-size: 16px;
font-weight: bold;
margin-top: 0;
......@@ -58,7 +56,7 @@ h2 {
}
h3 {
color: #3d4852;
color: #3D4852;
font-size: 14px;
font-weight: bold;
margin-top: 0;
......@@ -66,7 +64,7 @@ h3 {
}
p {
color: #3d4852;
color: #3D4852;
font-size: 16px;
line-height: 1.5em;
margin-top: 0;
......@@ -84,7 +82,7 @@ img {
/* Layout */
.wrapper {
background-color: #f8fafc;
background-color: #F8FAFC;
margin: 0;
padding: 0;
width: 100%;
......@@ -120,9 +118,9 @@ img {
/* Body */
.body {
background-color: #ffffff;
border-bottom: 1px solid #edeff2;
border-top: 1px solid #edeff2;
background-color: #FFFFFF;
border-bottom: 1px solid #EDEFF2;
border-top: 1px solid #EDEFF2;
margin: 0;
padding: 0;
width: 100%;
......@@ -132,7 +130,7 @@ img {
}
.inner-body {
background-color: #ffffff;
background-color: #FFFFFF;
margin: 0 auto;
padding: 0;
width: 570px;
......@@ -144,7 +142,7 @@ img {
/* Subcopy */
.subcopy {
border-top: 1px solid #edeff2;
border-top: 1px solid #EDEFF2;
margin-top: 25px;
padding-top: 25px;
}
......@@ -166,7 +164,7 @@ img {
}
.footer p {
color: #aeaeae;
color: #AEAEAE;
font-size: 12px;
text-align: center;
}
......@@ -182,13 +180,13 @@ img {
}
.table th {
border-bottom: 1px solid #edeff2;
border-bottom: 1px solid #EDEFF2;
padding-bottom: 8px;
margin: 0;
}
.table td {
color: #74787e;
color: #74787E;
font-size: 15px;
line-height: 18px;
padding: 10px 0;
......@@ -214,7 +212,7 @@ img {
.button {
border-radius: 3px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
color: #fff;
color: #FFF;
display: inline-block;
text-decoration: none;
-webkit-text-size-adjust: none;
......@@ -222,29 +220,29 @@ img {
.button-blue,
.button-primary {
background-color: #3490dc;
border-top: 10px solid #3490dc;
border-right: 18px solid #3490dc;
border-bottom: 10px solid #3490dc;
border-left: 18px solid #3490dc;
background-color: #3490DC;
border-top: 10px solid #3490DC;
border-right: 18px solid #3490DC;
border-bottom: 10px solid #3490DC;
border-left: 18px solid #3490DC;
}
.button-green,
.button-success {
background-color: #38c172;
border-top: 10px solid #38c172;
border-right: 18px solid #38c172;
border-bottom: 10px solid #38c172;
border-left: 18px solid #38c172;
background-color: #38C172;
border-top: 10px solid #38C172;
border-right: 18px solid #38C172;
border-bottom: 10px solid #38C172;
border-left: 18px solid #38C172;
}
.button-red,
.button-error {
background-color: #e3342f;
border-top: 10px solid #e3342f;
border-right: 18px solid #e3342f;
border-bottom: 10px solid #e3342f;
border-left: 18px solid #e3342f;
background-color: #E3342F;
border-top: 10px solid #E3342F;
border-right: 18px solid #E3342F;
border-bottom: 10px solid #E3342F;
border-left: 18px solid #E3342F;
}
/* Panels */
......@@ -254,7 +252,7 @@ img {
}
.panel-content {
background-color: #f1f5f8;
background-color: #F1F5F8;
padding: 16px;
}
......@@ -270,8 +268,8 @@ img {
/* Promotions */
.promotion {
background-color: #ffffff;
border: 2px dashed #9ba2ab;
background-color: #FFFFFF;
border: 2px dashed #9BA2AB;
margin: 0;
margin-bottom: 25px;
margin-top: 25px;
......
......@@ -98,7 +98,11 @@ class ListFailedCommand extends Command
{
preg_match('/"([^"]+)"/', $payload['data']['command'], $matches);
return $matches[1] ?? $payload['job'] ?? null;
if (isset($matches[1])) {
return $matches[1];
}
return $payload['job'] ?? null;
}
/**
......
......@@ -199,6 +199,8 @@ class DatabaseQueue extends Queue implements QueueContract
if ($job = $this->getNextAvailableJob($queue)) {
return $this->marshalJob($queue, $job);
}
return null;
});
}
......
......@@ -234,16 +234,6 @@ abstract class Job
}
/**
* Get the number of seconds to delay a failed job before retrying it.
*
* @return int|null
*/
public function delaySeconds()
{
return $this->payload()['delay'] ?? null;
}
/**
* Get the number of seconds the job can run.
*
* @return int|null
......
......@@ -124,7 +124,6 @@ abstract class Queue
'displayName' => $this->getDisplayName($job),
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'delay' => $this->getJobRetryDelay($job),
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
......@@ -154,24 +153,6 @@ abstract class Queue
}
/**
* Get the retry delay for an object-based queue handler.
*
* @param mixed $job
* @return mixed
*/
public function getJobRetryDelay($job)
{
if (! method_exists($job, 'retryAfter') && ! isset($job->retryAfter)) {
return;
}
$delay = $job->retryAfter ?? $job->retryAfter();
return $delay instanceof DateTimeInterface
? $this->secondsUntil($delay) : $delay;
}
/**
* Get the expiration timestamp for an object-based queue handler.
*
* @param mixed $job
......@@ -203,7 +184,6 @@ abstract class Queue
'displayName' => is_string($job) ? explode('@', $job)[0] : null,
'job' => $job,
'maxTries' => null,
'delay' => null,
'timeout' => null,
'data' => $data,
]);
......
......@@ -367,11 +367,7 @@ class Worker
// so it is not lost entirely. This'll let the job be retried at a later time by
// another listener (or this same one). We will re-throw this exception after.
if (! $job->isDeleted() && ! $job->isReleased() && ! $job->hasFailed()) {
$job->release(
method_exists($job, 'delaySeconds') && ! is_null($job->delaySeconds())
? $job->delaySeconds()
: $options->delay
);
$job->release($options->delay);
}
}
......
......@@ -327,15 +327,11 @@ class Str
*/
public static function replaceArray($search, array $replace, $subject)
{
$segments = explode($search, $subject);
$result = array_shift($segments);
foreach ($segments as $segment) {
$result .= (array_shift($replace) ?? $search).$segment;
foreach ($replace as $value) {
$subject = static::replaceFirst($search, $value, $subject);
}
return $result;
return $subject;
}
/**
......
......@@ -173,7 +173,11 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher
*/
protected function notificationsFor($notifiable, $notification)
{
return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? [];
if (isset($this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification])) {
return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification];
}
return [];
}
/**
......
......@@ -25,7 +25,11 @@ class ArrayLoader implements Loader
{
$namespace = $namespace ?: '*';
return $this->messages[$namespace][$locale][$group] ?? [];
if (isset($this->messages[$namespace][$locale][$group])) {
return $this->messages[$namespace][$locale][$group];
}
return [];
}
/**
......
......@@ -131,7 +131,11 @@ class Translator extends NamespacedItemResolver implements TranslatorContract
// If the line doesn't exist, we will return back the key which was requested as
// that will be quick to spot in the UI if language keys are wrong or missing
// from the application's language files. Otherwise we can return the line.
return $line ?? $key;
if (isset($line)) {
return $line;
}
return $key;
}
/**
......
<!--
🛑 DON'T REMOVE ME.
This issue template apply to all
- bug reports,
- feature proposals,
- and documentation requests
Having all those informations will allow us to know exactly
what you expect and answer you faster and precisely (answer
that matches your Carbon version, PHP version and usage).
Note: Comments between <!- - and - -> won't appear in the final
issue (See [Preview] tab).
-->
Hello,
I encountered an issue with the following code:
```php
echo Carbon::parse('2018-06-01')->subDay()->month;
```
Carbon version: **PUT HERE YOUR COMPOSER CARBON VERSION**
PHP version: **PUT HERE YOUR PHP VERSION**
<!--
Run the command `composer show nesbot/carbon`
to get "versions"
Use `echo phpversion();`
to get PHP version.
Some issues can depends on your context, settings,
macros, timezone, language. So to be sure the code
you give is enough to reproduce your bug, try it
first in:
https://try-carbon.herokuapp.com/?theme=xcode&export&embed
You can use the [Options] button to change the version
then when you get the bug with this editor, you can use
the [Export] button, copy the link of the opened tab,
then paste it in the issue. Then we can immediatly get
your issue.
Run the command `composer show nesbot/carbon`
to get "versions"
Use `echo phpversion();`
to get PHP version.
Some issues can depends on your context, settings,
macros, timezone, language. So to be sure the code
you give is enough to reproduce your bug, try it
first in:
https://try-carbon.herokuapp.com/?theme=xcode&export&embed
You can use the [Options] button to change the version
then when you get the bug with this editor, you can use
the [Export] button, copy the link of the opened tab,
then paste it in the issue. Then we can immediatly get
your issue.
-->
I expected to get:
```
6
```
<!--
Always give your expectations. Each use has their owns.
You may want daylight saving time to be taken into account,
someone else want it to be ignored. You may want timezone
to be used in comparisons, someone else may not, etc.
Always give your expectations. Each use has their owns.
You may want daylight saving time to be taken into account,
someone else want it to be ignored. You may want timezone
to be used in comparisons, someone else may not, etc.
-->
But I actually get:
```
5
```
<!--
If you did not succeed to get the same result in
https://try-carbon.herokuapp.com/ then precise the
result you get.
If you did not succeed to get the same result in
https://try-carbon.herokuapp.com/ then precise the
result you get.
-->
Thanks!
Thanks!
\ No newline at end of file
......@@ -17,7 +17,6 @@
* - JD Isaacks
* - Jens Herlevsen
* - Ulrik McArdle (mcardle)
* - Frederik Sauer (FrittenKeeZ)
*/
return [
'year' => ':count år|:count år',
......@@ -25,13 +24,13 @@ return [
'y' => ':count år|:count år',
'month' => ':count måned|:count måneder',
'a_month' => 'en måned|:count måneder',
'm' => ':count mdr.',
'm' => ':count mån.',
'week' => ':count uge|:count uger',
'a_week' => 'en uge|:count uger',
'w' => ':count u.',
'day' => ':count dag|:count dage',
'a_day' => ':count dag|:count dage',
'd' => ':count d.',
'd' => 'en d.',
'hour' => ':count time|:count timer',
'a_hour' => 'en time|:count timer',
'h' => ':count t.',
......
......@@ -4,7 +4,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- master
sudo: false
......
......@@ -2,16 +2,6 @@
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [4.2.1] - 2019-04-25
* Fixed an issue in `Runtime::getCurrentSettings()`
## [4.2.0] - 2019-04-25
### Added
* Implemented [#36](https://github.com/sebastianbergmann/environment/pull/36): `Runtime::getCurrentSettings()`
## [4.1.0] - 2019-02-01
### Added
......@@ -85,8 +75,6 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
* This component is no longer supported on PHP 5.6
[4.2.1]: https://github.com/sebastianbergmann/phpunit/compare/4.2.0...4.2.1
[4.2.0]: https://github.com/sebastianbergmann/phpunit/compare/4.1.0...4.2.0
[4.1.0]: https://github.com/sebastianbergmann/phpunit/compare/4.0.2...4.1.0
[4.0.2]: https://github.com/sebastianbergmann/phpunit/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/sebastianbergmann/phpunit/compare/66691f8e2dc4641909166b275a9a4f45c0e89092...4.0.1
......
......@@ -31,7 +31,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
"dev-master": "4.1-dev"
}
}
}
......@@ -218,50 +218,4 @@ final class Runtime
{
return $this->isPHP() && \extension_loaded('pcov') && \ini_get('pcov.enabled');
}
/**
* Parses the loaded php.ini file (if any) as well as all
* additional php.ini files from the additional ini dir for
* a list of all configuration settings loaded from files
* at startup. Then checks for each php.ini setting passed
* via the `$values` parameter whether this setting has
* been changed at runtime. Returns an array of strings
* where each string has the format `key=value` denoting
* the name of a changed php.ini setting with its new value.
*
* @return string[]
*/
public function getCurrentSettings(array $values): array
{
$diff = [];
$files = [];
if ($file = \php_ini_loaded_file()) {
$files[] = $file;
}
if ($scanned = \php_ini_scanned_files()) {
$files = \array_merge(
$files,
\array_map(
'trim',
\explode(",\n", $scanned)
)
);
}
foreach ($files as $ini) {
$config = \parse_ini_file($ini, true);
foreach ($values as $value) {
$set = \ini_get($value);
if (isset($config[$value]) && $set != $config[$value]) {
$diff[] = \sprintf('%s=%s', $value, $set);
}
}
}
return $diff;
}
}
Changelog
=========
6.2.1 (2019-04-21)
------------------
* reverted "deprecated Swift_CharacterStream_ArrayCharacterStream and Swift_CharacterStream_NgCharacterStream in favor of Swift_CharacterStream_CharacterStream"
6.2.0 (2019-03-10)
------------------
......
......@@ -15,7 +15,7 @@
*/
abstract class Swift
{
const VERSION = '6.2.1';
const VERSION = '6.2.0';
public static $initialized = false;
public static $inits = [];
......
......@@ -8,6 +8,8 @@
* file that was distributed with this source code.
*/
@trigger_error(sprintf('The "%s" class is deprecated since Swiftmailer 6.2; use "%s" instead.', Swift_CharacterStream_ArrayCharacterStream::class, Swift_CharacterStream_CharacterStream::class), E_USER_DEPRECATED);
/**
* A CharacterStream implementation which stores characters in an internal array.
*
......
<?php
/*
* This file is part of SwiftMailer.
* (c) 2004-2009 Chris Corbyn
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* A CharacterStream implementation which stores characters in an internal array.
*
* @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterStream_CharacterStream implements Swift_CharacterStream
{
/**
* The char reader (lazy-loaded) for the current charset.
*
* @var Swift_CharacterReader
*/
private $charReader;
/**
* A factory for creating CharacterReader instances.
*
* @var Swift_CharacterReaderFactory
*/
private $charReaderFactory;
/**
* The character set this stream is using.
*
* @var string
*/
private $charset;
/**
* The data's stored as-is.
*
* @var string
*/
private $datas = '';
/**
* Number of bytes in the stream.
*
* @var int
*/
private $datasSize = 0;
/**
* Map.
*
* @var mixed
*/
private $map;
/**
* Map Type.
*
* @var int
*/
private $mapType = 0;
/**
* Number of characters in the stream.
*
* @var int
*/
private $charCount = 0;
/**
* Position in the stream.
*
* @var int
*/
private $currentPos = 0;
/**
* Constructor.
*
* @param string $charset
*/
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
{
$this->setCharacterReaderFactory($factory);
$this->setCharacterSet($charset);
}
/* -- Changing parameters of the stream -- */
/**
* Set the character set used in this CharacterStream.
*
* @param string $charset
*/
public function setCharacterSet($charset)
{
$this->charset = $charset;
$this->charReader = null;
$this->mapType = 0;
}
/**
* Set the CharacterReaderFactory for multi charset support.
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
$this->charReaderFactory = $factory;
}
public function flushContents()
{
$this->datas = null;
$this->map = null;
$this->charCount = 0;
$this->currentPos = 0;
$this->datasSize = 0;
}
public function importByteStream(Swift_OutputByteStream $os)
{
$this->flushContents();
$blocks = 512;
$os->setReadPointer(0);
while (false !== ($read = $os->read($blocks))) {
$this->write($read);
}
}
public function importString($string)
{
$this->flushContents();
$this->write($string);
}
public function read($length)
{
if ($this->currentPos >= $this->charCount) {
return false;
}
$ret = false;
$length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
switch ($this->mapType) {
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
$len = $length * $this->map;
$ret = substr($this->datas,
$this->currentPos * $this->map,
$len);
$this->currentPos += $length;
break;
case Swift_CharacterReader::MAP_TYPE_INVALID:
$ret = '';
for (; $this->currentPos < $length; ++$this->currentPos) {
if (isset($this->map[$this->currentPos])) {
$ret .= '?';
} else {
$ret .= $this->datas[$this->currentPos];
}
}
break;
case Swift_CharacterReader::MAP_TYPE_POSITIONS:
$end = $this->currentPos + $length;
$end = $end > $this->charCount ? $this->charCount : $end;
$ret = '';
$start = 0;
if ($this->currentPos > 0) {
$start = $this->map['p'][$this->currentPos - 1];
}
$to = $start;
for (; $this->currentPos < $end; ++$this->currentPos) {
if (isset($this->map['i'][$this->currentPos])) {
$ret .= substr($this->datas, $start, $to - $start).'?';
$start = $this->map['p'][$this->currentPos];
} else {
$to = $this->map['p'][$this->currentPos];
}
}
$ret .= substr($this->datas, $start, $to - $start);
break;
}
return $ret;
}
public function readBytes($length)
{
$read = $this->read($length);
if (false !== $read) {
$ret = array_map('ord', str_split($read, 1));
return $ret;
}
return false;
}
public function setPointer($charOffset)
{
if ($this->charCount < $charOffset) {
$charOffset = $this->charCount;
}
$this->currentPos = $charOffset;
}
public function write($chars)
{
if (!isset($this->charReader)) {
$this->charReader = $this->charReaderFactory->getReaderFor(
$this->charset);
$this->map = [];
$this->mapType = $this->charReader->getMapType();
}
$ignored = '';
$this->datas .= $chars;
$this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
if (false !== $ignored) {
$this->datasSize = strlen($this->datas) - strlen($ignored);
} else {
$this->datasSize = strlen($this->datas);
}
}
}
......@@ -8,255 +8,13 @@
* file that was distributed with this source code.
*/
@trigger_error(sprintf('The "%s" class is deprecated since Swiftmailer 6.2; use "%s" instead.', Swift_CharacterStream_NgCharacterStream::class, Swift_CharacterStream_CharacterStream::class), E_USER_DEPRECATED);
/**
* A CharacterStream implementation which stores characters in an internal array.
*
* @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
class Swift_CharacterStream_NgCharacterStream extends Swift_CharacterStream_CharacterStream
{
/**
* The char reader (lazy-loaded) for the current charset.
*
* @var Swift_CharacterReader
*/
private $charReader;
/**
* A factory for creating CharacterReader instances.
*
* @var Swift_CharacterReaderFactory
*/
private $charReaderFactory;
/**
* The character set this stream is using.
*
* @var string
*/
private $charset;
/**
* The data's stored as-is.
*
* @var string
*/
private $datas = '';
/**
* Number of bytes in the stream.
*
* @var int
*/
private $datasSize = 0;
/**
* Map.
*
* @var mixed
*/
private $map;
/**
* Map Type.
*
* @var int
*/
private $mapType = 0;
/**
* Number of characters in the stream.
*
* @var int
*/
private $charCount = 0;
/**
* Position in the stream.
*
* @var int
*/
private $currentPos = 0;
/**
* Constructor.
*
* @param string $charset
*/
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
{
$this->setCharacterReaderFactory($factory);
$this->setCharacterSet($charset);
}
/* -- Changing parameters of the stream -- */
/**
* Set the character set used in this CharacterStream.
*
* @param string $charset
*/
public function setCharacterSet($charset)
{
$this->charset = $charset;
$this->charReader = null;
$this->mapType = 0;
}
/**
* Set the CharacterReaderFactory for multi charset support.
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
$this->charReaderFactory = $factory;
}
/**
* @see Swift_CharacterStream::flushContents()
*/
public function flushContents()
{
$this->datas = null;
$this->map = null;
$this->charCount = 0;
$this->currentPos = 0;
$this->datasSize = 0;
}
/**
* @see Swift_CharacterStream::importByteStream()
*/
public function importByteStream(Swift_OutputByteStream $os)
{
$this->flushContents();
$blocks = 512;
$os->setReadPointer(0);
while (false !== ($read = $os->read($blocks))) {
$this->write($read);
}
}
/**
* @see Swift_CharacterStream::importString()
*
* @param string $string
*/
public function importString($string)
{
$this->flushContents();
$this->write($string);
}
/**
* @see Swift_CharacterStream::read()
*
* @param int $length
*
* @return string
*/
public function read($length)
{
if ($this->currentPos >= $this->charCount) {
return false;
}
$ret = false;
$length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
switch ($this->mapType) {
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
$len = $length * $this->map;
$ret = substr($this->datas,
$this->currentPos * $this->map,
$len);
$this->currentPos += $length;
break;
case Swift_CharacterReader::MAP_TYPE_INVALID:
$ret = '';
for (; $this->currentPos < $length; ++$this->currentPos) {
if (isset($this->map[$this->currentPos])) {
$ret .= '?';
} else {
$ret .= $this->datas[$this->currentPos];
}
}
break;
case Swift_CharacterReader::MAP_TYPE_POSITIONS:
$end = $this->currentPos + $length;
$end = $end > $this->charCount ? $this->charCount : $end;
$ret = '';
$start = 0;
if ($this->currentPos > 0) {
$start = $this->map['p'][$this->currentPos - 1];
}
$to = $start;
for (; $this->currentPos < $end; ++$this->currentPos) {
if (isset($this->map['i'][$this->currentPos])) {
$ret .= substr($this->datas, $start, $to - $start).'?';
$start = $this->map['p'][$this->currentPos];
} else {
$to = $this->map['p'][$this->currentPos];
}
}
$ret .= substr($this->datas, $start, $to - $start);
break;
}
return $ret;
}
/**
* @see Swift_CharacterStream::readBytes()
*
* @param int $length
*
* @return int[]
*/
public function readBytes($length)
{
$read = $this->read($length);
if (false !== $read) {
$ret = array_map('ord', str_split($read, 1));
return $ret;
}
return false;
}
/**
* @see Swift_CharacterStream::setPointer()
*
* @param int $charOffset
*/
public function setPointer($charOffset)
{
if ($this->charCount < $charOffset) {
$charOffset = $this->charCount;
}
$this->currentPos = $charOffset;
}
/**
* @see Swift_CharacterStream::write()
*
* @param string $chars
*/
public function write($chars)
{
if (!isset($this->charReader)) {
$this->charReader = $this->charReaderFactory->getReaderFor(
$this->charset);
$this->map = [];
$this->mapType = $this->charReader->getMapType();
}
$ignored = '';
$this->datas .= $chars;
$this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
if (false !== $ignored) {
$this->datasSize = strlen($this->datas) - strlen($ignored);
} else {
$this->datasSize = strlen($this->datas);
}
}
}
......@@ -84,7 +84,7 @@ Swift_DependencyContainer::getInstance()
->withDependencies(['mime.charstream'])
->register('mime.charstream')
->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')
->asNewInstanceOf('Swift_CharacterStream_CharacterStream')
->withDependencies(['mime.characterreaderfactory', 'properties.charset'])
->register('mime.bytecanonicalizer')
......
......@@ -20,7 +20,7 @@ class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_ArrayCharacterStream(
$charStream = new Swift_CharacterStream_CharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Encoder_QpEncoder($charStream);
......
......@@ -20,7 +20,7 @@ class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit\Framework\Test
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_ArrayCharacterStream(
$charStream = new Swift_CharacterStream_CharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
......
......@@ -18,10 +18,10 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit\Framework\TestCase
$this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
......
......@@ -25,7 +25,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit\
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_NgCharacterStream(
$charStream = new Swift_CharacterStream_CharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
......
......@@ -18,10 +18,10 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit\Framework\TestCase
$this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
......
......@@ -16,7 +16,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
);
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$this->contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'),
new Swift_CharacterStream_CharacterStream($factory, 'utf-8'),
new Swift_StreamFilters_ByteArrayReplacementFilter(
[[0x0D, 0x0A], [0x0D], [0x0A]],
[[0x0A], [0x0A], [0x0D, 0x0A]]
......@@ -24,10 +24,10 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
);
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
......
......@@ -10,10 +10,10 @@ class Swift_Bug206Test extends \PHPUnit\Framework\TestCase
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
);
$emailValidator = new EmailValidator();
$this->factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator);
......
......@@ -13,7 +13,7 @@ class Swift_Bug650Test extends \PHPUnit\Framework\TestCase
public function testMailboxHeaderEncoding($name, $expectedEncodedName)
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');
$charStream = new Swift_CharacterStream_CharacterStream($factory, 'utf-8');
$encoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream);
$header = new Swift_Mime_Headers_MailboxHeader('To', $encoder, new EmailValidator());
$header->setCharset('utf-8');
......
<?php
/**
* @group legacy
*/
class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCase
{
public function testValidatorAlgorithmOnImportString()
......
......@@ -393,7 +393,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
private function createEncoder()
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');
$charStream = new Swift_CharacterStream_CharacterStream($factory, 'utf-8');
return new Swift_Encoder_QpEncoder($charStream);
}
......
......@@ -499,7 +499,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
private function createEncoder()
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');
$charStream = new Swift_CharacterStream_CharacterStream($factory, 'utf-8');
return new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
}
......
......@@ -147,8 +147,8 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_CharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_CharacterStream($factory, 'utf-8'));
$emailValidator = new EmailValidator();
$headers = new Swift_Mime_SimpleHeaderSet(new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator));
......@@ -165,8 +165,8 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_CharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_CharacterStream($factory, 'utf-8'));
$emailValidator = new EmailValidator();
$headerFactory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator);
$headers = $this->getMockery('Swift_Mime_SimpleHeaderSet');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment