SchoolProfileSerializer::id()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * @file
5
 * Contains Drupal\esdportal_api\Serializers\SchoolProfileSerializer.
6
 */
7
8
namespace Drupal\esdportal_api\Serializers;
9
10
use Tobscure\JsonApi\SerializerAbstract;
11
/**
12
 * Serializes school profiles.
13
 */
14
class SchoolProfileSerializer extends SerializerAbstract {
15
  protected $type = 'school_profiles';
16
17
  /**
18
   * Nothing special here, yet.
19
   */
20
  protected function attributes($school_profile) {
21
    return $school_profile;
22
  }
23
24
  /**
25
   * Provides node id as id.
26
   */
27
  protected function id($school_profile) {
28
    return $school_profile->nid;
29
  }
30
31
  /**
32
   * Backwards-compatible with bnchdrff/json-api version.
33
   */
34
  protected function getId($school_profile) {
35
    return $school_profile->nid;
36
  }
37
38
}
39