Skip to content

Commit

Permalink
lock file and cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Mar 11, 2020
1 parent a9ab0e2 commit 38d833c
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 53 deletions.
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Config.php
Expand Up @@ -204,7 +204,7 @@ public function module($id, $config)
*/
public function callback(callable $fn)
{
return $this->addDefinition(New ConfigDefinition(ConfigDefinition::GROUP_CALLABLE, false, $fn));
return $this->addDefinition(new ConfigDefinition(ConfigDefinition::GROUP_CALLABLE, false, $fn));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/console/Controller.php
Expand Up @@ -45,7 +45,7 @@ public function isMuted()
*
* If a message is not a string, it will return var export to generate
* a returnable string from a message.
*
*
* @param mixed $message
* @return string
* @since 1.0.22
Expand Down
12 changes: 6 additions & 6 deletions core/helpers/ArrayHelper.php
Expand Up @@ -81,7 +81,7 @@ public static function coverSensitiveValues(array $data, array $keys = [])

/**
* Prepend an assoc array item as first entry for a given array.
*
*
* Adds the given key with value as first entry to $arr
*
* @param array $arr The array where the value should be prepend
Expand Down Expand Up @@ -140,13 +140,13 @@ public static function typeCast(array $array)
* ```
*
* Searching for the string `Bar` would return the the orignal array is bar would be found in both.
*
*
* In order to search only in certain keys defined $keys attribute:
*
*
* ```php
* ArrayHelper::search($data, 'Foo', false, ['name']);
* ```
*
*
* The above example will search only in the array key `name` for the `Foo` expression.
*
* @param array $array The multidimensional array keys.
Expand Down Expand Up @@ -297,10 +297,10 @@ public static function generateRange($from, $to, $text = null)

/**
* Helper method to generate an array with the same keys and values.
*
*
* ```php
* $data = ArrayHelper::combine(['foo', 'bar']);
*
*
* // generates
* ['foo' => 'foo', 'bar' => 'bar'];
* ```
Expand Down
2 changes: 1 addition & 1 deletion core/helpers/ExportHelper.php
Expand Up @@ -137,7 +137,7 @@ protected static function generateContentArray($contentRows, array $keys, $gener

/**
* Generate the output string with delimiters.
*
*
* @param array $input
* @param string $delimiter
* @return null|string
Expand Down
6 changes: 3 additions & 3 deletions core/helpers/StringHelper.php
Expand Up @@ -126,15 +126,15 @@ public static function replaceFirst($search, $replace, $subject)
*
* If an array of needle words is provided the $strict parameter defines whether all need keys must be found
* in the string to get the `true` response or if just one of the keys are found the response is already `true`.
*
*
* ```php
* if (StringHelper::contains('foo', 'the foo bar Bar'')) {
* echo "yes!";
* }
* ```
*
*
* check if one of the given needles exists:
*
*
* ```php
* if (StringHelper::contains(['jungle', 'hell0], 'Welcome to the jungle!)) {
* echo "yes!";
Expand Down
2 changes: 1 addition & 1 deletion core/helpers/Url.php
Expand Up @@ -122,7 +122,7 @@ public static function domain($url)

/**
* Append a query to the current url.
*
*
* See {{luya\helpers\Url::appendToUrl()}}
*
* @param string|array $append A string with url fragments or an array which will be processed by http_build_query.
Expand Down
2 changes: 1 addition & 1 deletion core/lazyload/LazyLoadAsset.php
Expand Up @@ -30,4 +30,4 @@ class LazyLoadAsset extends Asset
public $depends = [
'yii\web\JqueryAsset',
];
}
}
4 changes: 2 additions & 2 deletions core/texttospeech/TextToSpeechAsset.php
Expand Up @@ -6,7 +6,7 @@

/**
* Text to Speech Asset.
*
*
* @author Martin Petrasch <martin@zephir.ch>
* @author Basil Suter <git@nadar.io>
* @since 1.1.0
Expand All @@ -31,4 +31,4 @@ class TextToSpeechAsset extends Asset
public $depends = [
'yii\web\JqueryAsset',
];
}
}
3 changes: 1 addition & 2 deletions core/theme/ThemeManager.php
Expand Up @@ -63,7 +63,6 @@ public static function loadThemeConfig(string $basePath)
// if basePath is the theme file itself and existing process:
$basePath = pathinfo($basePath, PATHINFO_DIRNAME);
} else {

if (!is_dir($dir) || !is_readable($dir)) {
throw new Exception('Theme directory not exists or readable: ' . $dir);
}
Expand Down Expand Up @@ -96,7 +95,7 @@ final public function setup()
$basePath = $this->getActiveThemeBasePath();
$this->beforeSetup($basePath);

if ($basePath) {
if ($basePath) {
$themeConfig = $this->getThemeByBasePath($basePath);
$theme = new Theme($themeConfig);
$this->activate($theme);
Expand Down
12 changes: 6 additions & 6 deletions core/traits/ApplicationTrait.php
Expand Up @@ -94,10 +94,10 @@ trait ApplicationTrait

/**
* @var array An array to provide application wide CORS settings.
*
*
* By default the X-Headers of Yii and LUYA Admin are exposed. In order to override the cors
* config the following example would work (including cors class definition).
*
*
* ```php
* 'corsConfig' => [
* 'class' => 'yii\filters\Cors',
Expand All @@ -113,7 +113,7 @@ trait ApplicationTrait
* ],
* ]
* ```
*
*
* @since 1.0.22
*/
public $corsConfig = [
Expand All @@ -125,7 +125,7 @@ trait ApplicationTrait
'Access-Control-Allow-Credentials' => null,
'Access-Control-Max-Age' => 86400,
'Access-Control-Expose-Headers' => [
'X-Pagination-Current-Page',
'X-Pagination-Current-Page',
'X-Pagination-Page-Count',
'X-Pagination-Per-Page',
'X-Pagination-Total-Count',
Expand Down Expand Up @@ -176,11 +176,11 @@ public function ensureLocale($lang)

/**
* Set the application localisation trough `setlocale`.
*
*
* The value will be parsed trough {{ensureLocale()}} in order to generated different possible localisation
* values like `en_EN` or `en_EN.utf8` and it will generate from `de` a locale value like `de_DE`.
*
* setlocale() can have multiple arguments:
* setlocale() can have multiple arguments:
*
* > If locale is an array or followed by additional parameters then each array element or parameter
* > is tried to be set as new locale until success. This is useful if a locale is known under different
Expand Down
17 changes: 8 additions & 9 deletions core/validators/PhoneNumberValidator.php
Expand Up @@ -11,19 +11,19 @@

/**
* Phone Number Validator.
*
*
* Validates a given phone number, and converts into standardized format by default. See {{PhoneNumberValidator::$autoFormat}}
*
*
* @see https://github.com/giggsey/libphonenumber-for-php This library is used to parse, format and validate.
* @author Basil Suter <basil@nadar.io>
* @since 1.0.25
*/
class PhoneNumberValidator extends Validator
{
/**
* @var string If a phone number does not contain the country prefix (+41 f.e), define a default country format which then defines the
* @var string If a phone number does not contain the country prefix (+41 f.e), define a default country format which then defines the
* country prefix.
*
*
* ```php
* 'country' => 'CH',
* ```
Expand All @@ -42,10 +42,10 @@ class PhoneNumberValidator extends Validator
public $autoFormatFormat = PhoneNumberFormat::E164;

/**
* @var integer If enabled, the validator will check the type of number. This can be usefull to test for mobile phone numbers.
*
* @var integer If enabled, the validator will check the type of number. This can be usefull to test for mobile phone numbers.
*
* An example to check for mobile phone numbers:
*
*
* ```php
* 'type' => \libphonenumber\PhoneNumberType::MOBILE
* ```
Expand Down Expand Up @@ -77,9 +77,8 @@ public function validateAttribute($model, $attribute)
if ($this->autoFormat) {
$model->{$attribute} = $phoneUtil->format($number, $this->autoFormatFormat);
}

} catch (NumberParseException $exception) {
$this->addError($model, $attribute, Yii::t('luya', 'Invalid phone number, ensure it starts with the correct country code.'));
}
}
}
}
4 changes: 2 additions & 2 deletions core/web/Composition.php
Expand Up @@ -107,14 +107,14 @@ class Composition extends Component implements \ArrayAccess
* This filter provides protection against ['host header' attacks](https://www.acunetix.com/vulnerabilities/web/host-header-attack).
*
* The allowed hosts check does not care about the protocol (https/http), there fore take a look the {{luya\traits\ApplicationTrait::$ensureSecureConnection}}.
*
*
* ```php
* 'allowedHosts' => [
* 'example.com', // this does not include www.
* '*.example.com', // this incluides www. and all other subdomains.
* ]
* ```
*
*
* > In order to allow all subdomains including www or not use `*example.com`.
*
* If no value is defined, the allowed host filtering is disable, this is the default behavior.
Expand Down
3 changes: 1 addition & 2 deletions core/widgets/SubmitButtonWidget.php
Expand Up @@ -20,7 +20,7 @@
* SubmitButtonWidget::widget(['label' => 'Save', 'pushed' => 'Saving ...', 'options' => ['class' => 'btn btn-primary']]);
* $form::end();
* ```
*
*
* @property ActiveForm $activeForm Set active form context of the button.
*
* @author Basil Suter <basil@nadar.io>
Expand Down Expand Up @@ -113,5 +113,4 @@ public function run()

return Html::decode(Html::submitButton($this->label, $this->options));
}

}
4 changes: 2 additions & 2 deletions tests/core/ConfigTest.php
Expand Up @@ -272,7 +272,7 @@ public function testCallable()
]);

$this->assertTrue($config->isCliRuntime());
$config->callback(function(Config $cfg) {
$config->callback(function (Config $cfg) {
$cfg->setCliRuntime(false);
});
// to array runs the callable
Expand All @@ -286,7 +286,7 @@ public function testCallable()
]);

$this->assertTrue($config->isCliRuntime());
$config->callback(function(Config $cfg) {
$config->callback(function (Config $cfg) {
$cfg->setCliRuntime(false);
})->env(Config::ENV_PROD);
// to array runs the callable
Expand Down
2 changes: 1 addition & 1 deletion tests/core/texttospeech/TextToSpeechWidgetTest.php
Expand Up @@ -20,4 +20,4 @@ public function testRender()
<button type="button" style="height:30px; width:30px;" class="btn text-to-speech-button btn text-to-speech-button-stop-button" id="stop-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"/></svg></button>
</div>', $content);
}
}
}
1 change: 0 additions & 1 deletion tests/core/traits/RestBehaviorsTraitTest.php
Expand Up @@ -105,6 +105,5 @@ public function testCorsConfig()
$behaviors = $ctrl->behaviors();

$this->assertSame(['class' => 'invalid\cors\class'], $behaviors['cors']);

}
}
6 changes: 3 additions & 3 deletions tests/core/validators/PhoneNumberValidatorTest.php
Expand Up @@ -46,7 +46,6 @@ public function testWrongFormatButNumber()
public function testCorrectNumberWithOutCountryCode()
{
foreach ($this->correctNumbersWithoutCountryCode as $number => $expect) {

$model = new StubModelValidatorPhone();
$model->value = $number;
$validator = new PhoneNumberValidator();
Expand All @@ -63,7 +62,6 @@ public function testCorrectNumberWithOutCountryCode()
public function testCorrectNumberWithCountryCode()
{
foreach ($this->correctNumbersWithCountryCode as $number => $expect) {

$model = new StubModelValidatorPhone();
$model->value = $number;
$validator = new PhoneNumberValidator();
Expand All @@ -88,7 +86,9 @@ public function testTypeCompare()
['value' => [
'The phone number does not match the required type FIXED_LINE.',
]
], $model->getErrors());
],
$model->getErrors()
);
$this->assertTrue($model->hasErrors());
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/core/web/ViewTest.php
Expand Up @@ -65,6 +65,5 @@ public function testThemeSetup()
$expectedPath = realpath(Yii::getAlias('@luyatests/data/themes/blank'));
$this->assertEquals($expectedPath, $view->theme->basePath, 'Theme base path not correct.');
$this->assertEquals($expectedPath, Yii::getAlias('@activeTheme'), 'Alias path is not correct.');

}
}

0 comments on commit 38d833c

Please sign in to comment.