for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace flipbox\saml\core\records\traits;
use craft\elements\User;
use flipbox\saml\core\records\AbstractProvider;
/**
* Trait MapUser
* @package flipbox\saml\core\records\traits
* @mixin AbstractProvider
*/
trait MapUser
{
* Current only used on the IDP side with this provider being the SP
*
* @param User $user
* @return string|null
* @throws \Throwable
* @throws \yii\base\Exception
public function assignNameId(User $user)
// Defaults to username
$nameId = $user->username;
if ($this->nameIdOverride) {
$nameId = \Craft::$app->view->renderObjectTemplate(
$this->nameIdOverride,
nameIdOverride
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$user
);
}
return $nameId;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: