Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Qoraiche committed Sep 28, 2019
1 parent 4137a61 commit c04b3b6
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/mailEclipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use ErrorException;
use ReflectionClass;
use ReflectionProperty;
use ReeceM\Mocker\Mocked;
use Illuminate\Support\Str;
use Illuminate\Mail\Markdown;
use RecursiveIteratorIterator;
Expand All @@ -14,7 +15,6 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Container\Container;
use Illuminate\Support\Facades\View;
use ReeceM\Mocker\Mocked;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Database\Eloquent\Factory as EloquentFactory;

Expand All @@ -24,14 +24,14 @@ class mailEclipse

/**
* Default type examples for being passed to reflected classes.
*
*
* @var array TYPES
*/
public const TYPES = [
'int' => 31,
// 'string' => 'test_string', // not needed as it can be cast __toString()
'bool' => false,
'float' => 3.14159
'float' => 3.14159,
];

public static function getMailables()
Expand Down Expand Up @@ -574,7 +574,7 @@ public static function handleMailableViewDataArgs($mailable)
$reflection = new ReflectionClass($mailable);

$params = $reflection->getConstructor()->getParameters();

DB::beginTransaction();

$eloquentFactory = app(EloquentFactory::class);
Expand Down Expand Up @@ -637,35 +637,33 @@ public static function handleMailableViewDataArgs($mailable)

/**
* Gets any missing params that may not be collectable in the reflection.
*
*
* @param string $arg the argument string|array
* @param array $params the reflection param list
*
*
* @return array|string|\ReeceM\Mocker\Mocked
*/
private static function getMissingParams($arg, $params)
{
/**
* Determine if a builtin type can be found.
* Not a string or object as a Mocked::class can work there
*
* Not a string or object as a Mocked::class can work there.
*
* ->getType() needs to be cast to string to get the protected prop.
*/
$argType = (string)collect($params)->where('name', $arg)->first()->getType();
$argType = (string) collect($params)->where('name', $arg)->first()->getType();

$argType = self::TYPES[$argType] ?? null;

try {
return !is_null($argType)
? $argType
return ! is_null($argType)
? $argType
: new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton());

} catch (\Exception $e) {
return $arg;
}
}


private static function getMailableViewData($mailable, $mailable_data)
{
$traitProperties = [];
Expand Down

0 comments on commit c04b3b6

Please sign in to comment.