/**
  * Get a SharePoint File by Relative URL
  *
  * @static
  * @access  public
  * @param   SPSite $site        SharePoint Site
  * @param   string $relativeUrl SharePoint Folder relative URL
  * @param   array  $extra       Extra properties to map
  * @throws  SPException
  * @return  SPFile
  */
 public static function getByRelativeUrl(SPSite $site, $relativeUrl, array $extra = [])
 {
     $json = $site->request("_api/web/GetFileByServerRelativeUrl('" . $relativeUrl . "')", ['headers' => ['Authorization' => 'Bearer ' . $site->getSPAccessToken(), 'Accept' => 'application/json'], 'query' => ['$expand' => 'ListItemAllFields,Author']]);
     $folder = SPFolder::getByRelativeUrl($site, dirname($relativeUrl));
     return new static($folder, $json, $extra);
 }
 /**
  * Create a SharePoint Form Digest
  *
  * @static
  * @access  public
  * @param   SPSite $site  SharePoint List
  * @param   array  $extra Extra SharePoint Form Digest properties to map
  * @throws  SPException
  * @return  SPFormDigest
  */
 public static function create(SPSite $site, array $extra = [])
 {
     $json = $site->request('_api/contextinfo', ['headers' => ['Authorization' => 'Bearer ' . $site->getSPAccessToken(), 'Accept' => 'application/json']], 'POST');
     return new static($json, $extra);
 }
 /**
  * Create a SharePoint Access Token (App-only Policy)
  *
  * @static
  * @access  public
  * @param   SPSite $site  SharePoint Site
  * @param   array  $extra Extra SharePoint Access Token properties to map
  * @throws  SPException
  * @return  SPAccessToken
  */
 public static function createAOP(SPSite $site, array $extra = [])
 {
     $config = $site->getConfig();
     if (empty($config['secret'])) {
         throw new SPException('The Secret is empty/not set');
     }
     if (empty($config['acs'])) {
         throw new SPException('The Azure Access Control Service URL is empty/not set');
     }
     if (!filter_var($config['acs'], FILTER_VALIDATE_URL)) {
         throw new SPException('The Azure Access Control Service URL is invalid');
     }
     if (empty($config['client_id'])) {
         throw new SPException('The Client ID is empty/not set');
     }
     if (empty($config['resource'])) {
         throw new SPException('The Resource is empty/not set');
     }
     $json = $site->request($config['acs'], ['headers' => ['Content-Type' => 'application/x-www-form-urlencoded'], 'body' => http_build_query(['grant_type' => 'client_credentials', 'client_id' => $config['client_id'], 'client_secret' => $config['secret'], 'resource' => $config['resource']])], 'POST');
     return new static($json, $extra);
 }
 /**
  * {@inheritdoc}
  */
 public function request($url, array $options = [], $method = 'GET', $json = true)
 {
     return $this->site->request($url, $options, $method, $json);
 }