/src/models/jsonld/ComputerLanguage.php

https://github.com/nystudio107/craft-seomatic · PHP · 325 lines · 107 code · 39 blank · 179 comment · 0 complexity · 50ef62a036ae33a696f0011353a83ab3 MD5 · raw file

  1. <?php
  2. /**
  3. * SEOmatic plugin for Craft CMS 3.x
  4. *
  5. * A turnkey SEO implementation for Craft CMS that is comprehensive, powerful,
  6. * and flexible
  7. *
  8. * @link https://nystudio107.com
  9. * @copyright Copyright (c) 2017 nystudio107
  10. */
  11. namespace nystudio107\seomatic\models\jsonld;
  12. use nystudio107\seomatic\models\jsonld\Intangible;
  13. /**
  14. * ComputerLanguage - This type covers computer programming languages such as
  15. * Scheme and Lisp, as well as other language-like computer representations.
  16. * Natural languages are best represented with the Language type.
  17. *
  18. * @author nystudio107
  19. * @package Seomatic
  20. * @since 3.0.0
  21. * @see http://schema.org/ComputerLanguage
  22. */
  23. class ComputerLanguage extends Intangible
  24. {
  25. // Static Public Properties
  26. // =========================================================================
  27. /**
  28. * The Schema.org Type Name
  29. *
  30. * @var string
  31. */
  32. static public $schemaTypeName = 'ComputerLanguage';
  33. /**
  34. * The Schema.org Type Scope
  35. *
  36. * @var string
  37. */
  38. static public $schemaTypeScope = 'https://schema.org/ComputerLanguage';
  39. /**
  40. * The Schema.org Type Description
  41. *
  42. * @var string
  43. */
  44. static public $schemaTypeDescription = 'This type covers computer programming languages such as Scheme and Lisp, as well as other language-like computer representations. Natural languages are best represented with the Language type.';
  45. /**
  46. * The Schema.org Type Extends
  47. *
  48. * @var string
  49. */
  50. static public $schemaTypeExtends = 'Intangible';
  51. /**
  52. * The Schema.org composed Property Names
  53. *
  54. * @var array
  55. */
  56. static public $schemaPropertyNames = [];
  57. /**
  58. * The Schema.org composed Property Expected Types
  59. *
  60. * @var array
  61. */
  62. static public $schemaPropertyExpectedTypes = [];
  63. /**
  64. * The Schema.org composed Property Descriptions
  65. *
  66. * @var array
  67. */
  68. static public $schemaPropertyDescriptions = [];
  69. /**
  70. * The Schema.org composed Google Required Schema for this type
  71. *
  72. * @var array
  73. */
  74. static public $googleRequiredSchema = [];
  75. /**
  76. * The Schema.org composed Google Recommended Schema for this type
  77. *
  78. * @var array
  79. */
  80. static public $googleRecommendedSchema = [];
  81. // Public Properties
  82. // =========================================================================
  83. /**
  84. * An additional type for the item, typically used for adding more specific
  85. * types from external vocabularies in microdata syntax. This is a
  86. * relationship between something and a class that the thing is in. In RDFa
  87. * syntax, it is better to use the native RDFa syntax - the 'typeof' attribute
  88. * - for multiple types. Schema.org tools may have only weaker understanding
  89. * of extra types, in particular those defined externally.
  90. *
  91. * @var string [schema.org types: URL]
  92. */
  93. public $additionalType;
  94. /**
  95. * An alias for the item.
  96. *
  97. * @var string [schema.org types: Text]
  98. */
  99. public $alternateName;
  100. /**
  101. * A description of the item.
  102. *
  103. * @var string [schema.org types: Text]
  104. */
  105. public $description;
  106. /**
  107. * A sub property of description. A short description of the item used to
  108. * disambiguate from other, similar items. Information from other properties
  109. * (in particular, name) may be necessary for the description to be useful for
  110. * disambiguation.
  111. *
  112. * @var string [schema.org types: Text]
  113. */
  114. public $disambiguatingDescription;
  115. /**
  116. * The identifier property represents any kind of identifier for any kind of
  117. * Thing, such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides dedicated
  118. * properties for representing many of these, either as textual strings or as
  119. * URL (URI) links. See background notes for more details.
  120. *
  121. * @var mixed|PropertyValue|string|string [schema.org types: PropertyValue, Text, URL]
  122. */
  123. public $identifier;
  124. /**
  125. * An image of the item. This can be a URL or a fully described ImageObject.
  126. *
  127. * @var mixed|ImageObject|string [schema.org types: ImageObject, URL]
  128. */
  129. public $image;
  130. /**
  131. * Indicates a page (or other CreativeWork) for which this thing is the main
  132. * entity being described. See background notes for details. Inverse property:
  133. * mainEntity.
  134. *
  135. * @var mixed|CreativeWork|string [schema.org types: CreativeWork, URL]
  136. */
  137. public $mainEntityOfPage;
  138. /**
  139. * The name of the item.
  140. *
  141. * @var string [schema.org types: Text]
  142. */
  143. public $name;
  144. /**
  145. * Indicates a potential Action, which describes an idealized action in which
  146. * this thing would play an 'object' role.
  147. *
  148. * @var Action [schema.org types: Action]
  149. */
  150. public $potentialAction;
  151. /**
  152. * URL of a reference Web page that unambiguously indicates the item's
  153. * identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or
  154. * official website.
  155. *
  156. * @var string [schema.org types: URL]
  157. */
  158. public $sameAs;
  159. /**
  160. * A CreativeWork or Event about this Thing. Inverse property: about.
  161. *
  162. * @var mixed|CreativeWork|Event [schema.org types: CreativeWork, Event]
  163. */
  164. public $subjectOf;
  165. /**
  166. * URL of the item.
  167. *
  168. * @var string [schema.org types: URL]
  169. */
  170. public $url;
  171. // Static Protected Properties
  172. // =========================================================================
  173. /**
  174. * The Schema.org Property Names
  175. *
  176. * @var array
  177. */
  178. static protected $_schemaPropertyNames = [
  179. 'additionalType',
  180. 'alternateName',
  181. 'description',
  182. 'disambiguatingDescription',
  183. 'identifier',
  184. 'image',
  185. 'mainEntityOfPage',
  186. 'name',
  187. 'potentialAction',
  188. 'sameAs',
  189. 'subjectOf',
  190. 'url'
  191. ];
  192. /**
  193. * The Schema.org Property Expected Types
  194. *
  195. * @var array
  196. */
  197. static protected $_schemaPropertyExpectedTypes = [
  198. 'additionalType' => ['URL'],
  199. 'alternateName' => ['Text'],
  200. 'description' => ['Text'],
  201. 'disambiguatingDescription' => ['Text'],
  202. 'identifier' => ['PropertyValue','Text','URL'],
  203. 'image' => ['ImageObject','URL'],
  204. 'mainEntityOfPage' => ['CreativeWork','URL'],
  205. 'name' => ['Text'],
  206. 'potentialAction' => ['Action'],
  207. 'sameAs' => ['URL'],
  208. 'subjectOf' => ['CreativeWork','Event'],
  209. 'url' => ['URL']
  210. ];
  211. /**
  212. * The Schema.org Property Descriptions
  213. *
  214. * @var array
  215. */
  216. static protected $_schemaPropertyDescriptions = [
  217. 'additionalType' => 'An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in. In RDFa syntax, it is better to use the native RDFa syntax - the \'typeof\' attribute - for multiple types. Schema.org tools may have only weaker understanding of extra types, in particular those defined externally.',
  218. 'alternateName' => 'An alias for the item.',
  219. 'description' => 'A description of the item.',
  220. 'disambiguatingDescription' => 'A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.',
  221. 'identifier' => 'The identifier property represents any kind of identifier for any kind of Thing, such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides dedicated properties for representing many of these, either as textual strings or as URL (URI) links. See background notes for more details.',
  222. 'image' => 'An image of the item. This can be a URL or a fully described ImageObject.',
  223. 'mainEntityOfPage' => 'Indicates a page (or other CreativeWork) for which this thing is the main entity being described. See background notes for details. Inverse property: mainEntity.',
  224. 'name' => 'The name of the item.',
  225. 'potentialAction' => 'Indicates a potential Action, which describes an idealized action in which this thing would play an \'object\' role.',
  226. 'sameAs' => 'URL of a reference Web page that unambiguously indicates the item\'s identity. E.g. the URL of the item\'s Wikipedia page, Wikidata entry, or official website.',
  227. 'subjectOf' => 'A CreativeWork or Event about this Thing. Inverse property: about.',
  228. 'url' => 'URL of the item.'
  229. ];
  230. /**
  231. * The Schema.org Google Required Schema for this type
  232. *
  233. * @var array
  234. */
  235. static protected $_googleRequiredSchema = [
  236. ];
  237. /**
  238. * The Schema.org composed Google Recommended Schema for this type
  239. *
  240. * @var array
  241. */
  242. static protected $_googleRecommendedSchema = [
  243. ];
  244. // Public Methods
  245. // =========================================================================
  246. /**
  247. * @inheritdoc
  248. */
  249. public function init()
  250. {
  251. parent::init();
  252. self::$schemaPropertyNames = array_merge(
  253. parent::$schemaPropertyNames,
  254. self::$_schemaPropertyNames
  255. );
  256. self::$schemaPropertyExpectedTypes = array_merge(
  257. parent::$schemaPropertyExpectedTypes,
  258. self::$_schemaPropertyExpectedTypes
  259. );
  260. self::$schemaPropertyDescriptions = array_merge(
  261. parent::$schemaPropertyDescriptions,
  262. self::$_schemaPropertyDescriptions
  263. );
  264. self::$googleRequiredSchema = array_merge(
  265. parent::$googleRequiredSchema,
  266. self::$_googleRequiredSchema
  267. );
  268. self::$googleRecommendedSchema = array_merge(
  269. parent::$googleRecommendedSchema,
  270. self::$_googleRecommendedSchema
  271. );
  272. }
  273. /**
  274. * @inheritdoc
  275. */
  276. public function rules()
  277. {
  278. $rules = parent::rules();
  279. $rules = array_merge($rules, [
  280. [['additionalType','alternateName','description','disambiguatingDescription','identifier','image','mainEntityOfPage','name','potentialAction','sameAs','subjectOf','url'], 'validateJsonSchema'],
  281. [self::$_googleRequiredSchema, 'required', 'on' => ['google'], 'message' => 'This property is required by Google.'],
  282. [self::$_googleRecommendedSchema, 'required', 'on' => ['google'], 'message' => 'This property is recommended by Google.']
  283. ]);
  284. return $rules;
  285. }
  286. }