diff --git a/src/Connection.php b/src/Connection.php index 278642081..d6ed508a4 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -5,7 +5,6 @@ use function class_exists; use Composer\InstalledVersions; use Illuminate\Database\Connection as BaseConnection; -use Illuminate\Support\Arr; use InvalidArgumentException; use Jenssegers\Mongodb\Concerns\ManagesTransactions; use MongoDB\Client; @@ -48,7 +47,7 @@ public function __construct(array $config) $dsn = $this->getDsn($config); // You can pass options directly to the MongoDB constructor - $options = Arr::get($config, 'options', []); + $options = $config['options'] ?? []; // Create the connection $this->connection = $this->createConnection($dsn, $config, $options); diff --git a/src/Eloquent/Model.php b/src/Eloquent/Model.php index 2d985f627..1c66f7652 100644 --- a/src/Eloquent/Model.php +++ b/src/Eloquent/Model.php @@ -155,7 +155,7 @@ public function getAttribute($key) } // Dot notation support. - if (Str::contains($key, '.') && Arr::has($this->attributes, $key)) { + if (str_contains($key, '.') && Arr::has($this->attributes, $key)) { return $this->getAttributeValue($key); } @@ -177,7 +177,7 @@ public function getAttribute($key) protected function getAttributeFromArray($key) { // Support keys in dot notation. - if (Str::contains($key, '.')) { + if (str_contains($key, '.')) { return Arr::get($this->attributes, $key); } @@ -195,7 +195,7 @@ public function setAttribute($key, $value) $value = $builder->convertKey($value); } // Support keys in dot notation. - elseif (Str::contains($key, '.')) { + elseif (str_contains($key, '.')) { // Store to a temporary key, then move data to the actual key $uniqueKey = uniqid($key); parent::setAttribute($uniqueKey, $value); diff --git a/src/Query/Builder.php b/src/Query/Builder.php index dd448ed01..69bcd8ea0 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -10,7 +10,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Collection; use Illuminate\Support\LazyCollection; -use Illuminate\Support\Str; use Jenssegers\Mongodb\Connection; use MongoDB\BSON\Binary; use MongoDB\BSON\ObjectID; @@ -617,7 +616,7 @@ public function insertGetId(array $values, $sequence = null) public function update(array $values, array $options = []) { // Use $set as default operator. - if (! Str::startsWith(key($values), '$')) { + if (! str_starts_with(key($values), '$')) { $values = ['$set' => $values]; } @@ -951,7 +950,7 @@ protected function compileWheres(): array } // Convert id's. - if (isset($where['column']) && ($where['column'] == '_id' || Str::endsWith($where['column'], '._id'))) { + if (isset($where['column']) && ($where['column'] == '_id' || str_ends_with($where['column'], '._id'))) { // Multiple values. if (isset($where['values'])) { foreach ($where['values'] as &$value) { diff --git a/src/Queue/MongoConnector.php b/src/Queue/MongoConnector.php index f453ba0a4..8e74e59d0 100644 --- a/src/Queue/MongoConnector.php +++ b/src/Queue/MongoConnector.php @@ -4,7 +4,6 @@ use Illuminate\Database\ConnectionResolverInterface; use Illuminate\Queue\Connectors\ConnectorInterface; -use Illuminate\Support\Arr; class MongoConnector implements ConnectorInterface { @@ -34,10 +33,10 @@ public function __construct(ConnectionResolverInterface $connections) public function connect(array $config) { return new MongoQueue( - $this->connections->connection(Arr::get($config, 'connection')), + $this->connections->connection($config['connection'] ?? null), $config['table'], $config['queue'], - Arr::get($config, 'expire', 60) + $config['expire'] ?? 60 ); } }