original_string: private static function create_endpoints_for_microsoft($issuer) {
  
          $endpoints = [
              'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
              'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
              'userinfo_endpoint' => 'https://graph.microsoft.com/v1.0/me/',
              'userpicture_endpoint' => 'https://graph.microsoft.com/v1.0/me/photo/$value',
          ];
  
          foreach ($endpoints as $name => $url) {
              $record = (object) [
                  'issuerid' => $issuer->get('id'),
                  'name' => $name,
                  'url' => $url
              ];
              $endpoint = new endpoint(0, $record);
              $endpoint->create();
          }
  
          // Create the field mappings.
          $mapping = [
              'givenName' => 'firstname',
              'surname' => 'lastname',
              'userPrincipalName' => 'email',
              'displayName' => 'alternatename',
              'officeLocation' => 'address',
              'mobilePhone' => 'phone1',
              'preferredLanguage' => 'lang'
          ];
          foreach ($mapping as $external => $internal) {
              $record = (object) [
                  'issuerid' => $issuer->get('id'),
                  'externalfield' => $external,
                  'internalfield' => $internal
              ];
              $userfieldmapping = new user_field_mapping(0, $record);
              $userfieldmapping->create();
          }
          return $issuer;
      }
code: private static function create_endpoints_for_microsoft($issuer) {
  
          $endpoints = [
              'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
              'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
              'userinfo_endpoint' => 'https://graph.microsoft.com/v1.0/me/',
              'userpicture_endpoint' => 'https://graph.microsoft.com/v1.0/me/photo/$value',
          ];
  
          foreach ($endpoints as $name => $url) {
              $record = (object) [
                  'issuerid' => $issuer->get('id'),
                  'name' => $name,
                  'url' => $url
              ];
              $endpoint = new endpoint(0, $record);
              $endpoint->create();
          }
  
          // Create the field mappings.
          $mapping = [
              'givenName' => 'firstname',
              'surname' => 'lastname',
              'userPrincipalName' => 'email',
              'displayName' => 'alternatename',
              'officeLocation' => 'address',
              'mobilePhone' => 'phone1',
              'preferredLanguage' => 'lang'
          ];
          foreach ($mapping as $external => $internal) {
              $record = (object) [
                  'issuerid' => $issuer->get('id'),
                  'externalfield' => $external,
                  'internalfield' => $internal
              ];
              $userfieldmapping = new user_field_mapping(0, $record);
              $userfieldmapping->create();
          }
          return $issuer;
      }
code_tokens: private static function create_endpoints_for_microsoft ( $ issuer ) { $ endpoints = [ 'authorization_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' , 'token_endpoint' => 'https://login.microsoftonline.com/common/oauth2/v2.0/token' , 'userinfo_endpoint' => 'https://graph.microsoft.com/v1.0/me/' , 'userpicture_endpoint' => 'https://graph.microsoft.com/v1.0/me/photo/$value' , ] ; foreach ( $ endpoints as $ name => $ url ) { $ record = ( object ) [ 'issuerid' => $ issuer -> get ( 'id' ) , 'name' => $ name , 'url' => $ url ] ; $ endpoint = new endpoint ( 0 , $ record ) ; $ endpoint -> create ( ) ; } // Create the field mappings. $ mapping = [ 'givenName' => 'firstname' , 'surname' => 'lastname' , 'userPrincipalName' => 'email' , 'displayName' => 'alternatename' , 'officeLocation' => 'address' , 'mobilePhone' => 'phone1' , 'preferredLanguage' => 'lang' ] ; foreach ( $ mapping as $ external => $ internal ) { $ record = ( object ) [ 'issuerid' => $ issuer -> get ( 'id' ) , 'externalfield' => $ external , 'internalfield' => $ internal ] ; $ userfieldmapping = new user_field_mapping ( 0 , $ record ) ; $ userfieldmapping -> create ( ) ; } return $ issuer ; }
docstring: Create endpoints for microsoft issuers.
  @param issuer $issuer issuer the endpoints should be created for.
  @return mixed
  @throws \coding_exception
  @throws \core\invalid_persistent_exception
docstring_tokens: Create endpoints for microsoft issuers .