Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/IMAP/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Webklex\IMAP;

use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
use Webklex\IMAP\Exceptions\MaskNotFoundException;
use Webklex\IMAP\Exceptions\MethodNotFoundException;
Expand Down Expand Up @@ -111,15 +112,15 @@ public function __construct(Message $oMessage, $structure, $part_number = 1) {
*/
public function __call($method, $arguments) {
if(strtolower(substr($method, 0, 3)) === 'get') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

if(isset($this->attributes[$name])) {
return $this->attributes[$name];
}

return null;
}elseif (strtolower(substr($method, 0, 3)) === 'set') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

$this->attributes[$name] = array_pop($arguments);

Expand Down Expand Up @@ -336,4 +337,4 @@ public function mask($mask = null){

throw new MaskNotFoundException("Unknown mask provided: ".$mask);
}
}
}
5 changes: 3 additions & 2 deletions src/IMAP/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Webklex\IMAP;

use Carbon\Carbon;
use Illuminate\Support\Str;
use Webklex\IMAP\Exceptions\InvalidMessageDateException;
use Webklex\IMAP\Exceptions\MaskNotFoundException;
use Webklex\IMAP\Exceptions\MethodNotFoundException;
Expand Down Expand Up @@ -239,14 +240,14 @@ public function __construct($uid, $msglist, Client $client, $fetch_options = nul
*/
public function __call($method, $arguments) {
if(strtolower(substr($method, 0, 3)) === 'get') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

if(in_array($name, array_keys($this->attributes))) {
return $this->attributes[$name];
}

}elseif (strtolower(substr($method, 0, 3)) === 'set') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

if(in_array($name, array_keys($this->attributes))) {
$this->attributes[$name] = array_pop($arguments);
Expand Down
5 changes: 3 additions & 2 deletions src/IMAP/Query/WhereQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Webklex\IMAP\Query;

use Illuminate\Support\Str;
use Webklex\IMAP\Exceptions\InvalidWhereQueryCriteriaException;
use Webklex\IMAP\Exceptions\MethodNotFoundException;
use Webklex\IMAP\Exceptions\MessageSearchValidationException;
Expand Down Expand Up @@ -73,7 +74,7 @@ class WhereQuery extends Query {
public function __call($name, $arguments) {
$that = $this;

$name = camel_case($name);
$name = Str::camel($name);

if(strtolower(substr($name, 0, 3)) === 'not') {
$that = $that->whereNot();
Expand Down Expand Up @@ -425,4 +426,4 @@ public function whereIsXSpam(){
public function whereLanguage($country_code){
return $this->where("Content-Language $country_code");
}
}
}
7 changes: 4 additions & 3 deletions src/IMAP/Support/Masks/Mask.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Webklex\IMAP\Support\Masks;

use Illuminate\Support\Str;
use Webklex\IMAP\Exceptions\MethodNotFoundException;

/**
Expand Down Expand Up @@ -60,14 +61,14 @@ protected function boot(){}
*/
public function __call($method, $arguments) {
if(strtolower(substr($method, 0, 3)) === 'get') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

if(isset($this->attributes[$name])) {
return $this->attributes[$name];
}

}elseif (strtolower(substr($method, 0, 3)) === 'set') {
$name = snake_case(substr($method, 3));
$name = Str::snake(substr($method, 3));

if(isset($this->attributes[$name])) {
$this->attributes[$name] = array_pop($arguments);
Expand Down Expand Up @@ -123,4 +124,4 @@ public function getAttributes(){
return $this->attributes;
}

}
}