@@ -58,11 +58,11 @@ class ObjectType extends Type implements OutputType, CompositeType
5858 private $ _isTypeOf ;
5959
6060 /**
61- * Keeping reference of config for late bindings
61+ * Keeping reference of config for late bindings and custom app-level metadata
6262 *
6363 * @var array
6464 */
65- private $ _config ;
65+ public $ config ;
6666
6767 /**
6868 * @var callable
@@ -93,7 +93,7 @@ public function __construct(array $config)
9393 $ this ->description = isset ($ config ['description ' ]) ? $ config ['description ' ] : null ;
9494 $ this ->resolveFieldFn = isset ($ config ['resolveField ' ]) ? $ config ['resolveField ' ] : null ;
9595 $ this ->_isTypeOf = isset ($ config ['isTypeOf ' ]) ? $ config ['isTypeOf ' ] : null ;
96- $ this ->_config = $ config ;
96+ $ this ->config = $ config ;
9797
9898 if (isset ($ config ['interfaces ' ])) {
9999 InterfaceType::addImplementationToInterfaces ($ this );
@@ -106,7 +106,7 @@ public function __construct(array $config)
106106 public function getFields ()
107107 {
108108 if (null === $ this ->_fields ) {
109- $ fields = isset ($ this ->_config ['fields ' ]) ? $ this ->_config ['fields ' ] : [];
109+ $ fields = isset ($ this ->config ['fields ' ]) ? $ this ->config ['fields ' ] : [];
110110 $ fields = is_callable ($ fields ) ? call_user_func ($ fields ) : $ fields ;
111111 $ this ->_fields = FieldDefinition::createMap ($ fields );
112112 }
@@ -133,13 +133,22 @@ public function getField($name)
133133 public function getInterfaces ()
134134 {
135135 if (null === $ this ->_interfaces ) {
136- $ interfaces = isset ($ this ->_config ['interfaces ' ]) ? $ this ->_config ['interfaces ' ] : [];
136+ $ interfaces = isset ($ this ->config ['interfaces ' ]) ? $ this ->config ['interfaces ' ] : [];
137137 $ interfaces = is_callable ($ interfaces ) ? call_user_func ($ interfaces ) : $ interfaces ;
138138 $ this ->_interfaces = $ interfaces ;
139139 }
140140 return $ this ->_interfaces ;
141141 }
142142
143+ /**
144+ * @param InterfaceType $iface
145+ * @return bool
146+ */
147+ public function implementsInterface (InterfaceType $ iface )
148+ {
149+ return !!Utils::find ($ this ->getInterfaces (), function ($ implemented ) use ($ iface ) {return $ iface === $ implemented ;});
150+ }
151+
143152 /**
144153 * @param $value
145154 * @return bool|null
0 commit comments