original_string: public static function createWithDefaults(array $providers = [])
      {
          $providers = [
              [
                  'type' => 'orm',
                  'callable' => function ($request, $data) {
                      if (is_array($data['entity']) || $data['entity'] instanceof Traversable) {
                          $pass = (new Collection($data['entity']))->first() !== null;
                          if ($pass) {
                              return new EntityContext($request, $data);
                          }
                      }
                      if ($data['entity'] instanceof EntityInterface) {
                          return new EntityContext($request, $data);
                      }
                      if (is_array($data['entity']) && empty($data['entity']['schema'])) {
                          return new EntityContext($request, $data);
                      }
                  }
              ],
              [
                  'type' => 'array',
                  'callable' => function ($request, $data) {
                      if (is_array($data['entity']) && isset($data['entity']['schema'])) {
                          return new ArrayContext($request, $data['entity']);
                      }
                  }
              ],
              [
                  'type' => 'form',
                  'callable' => function ($request, $data) {
                      if ($data['entity'] instanceof Form) {
                          return new FormContext($request, $data);
                      }
                  }
              ],
          ] + $providers;
  
          return new static($providers);
      }
code: public static function createWithDefaults(array $providers = [])
      {
          $providers = [
              [
                  'type' => 'orm',
                  'callable' => function ($request, $data) {
                      if (is_array($data['entity']) || $data['entity'] instanceof Traversable) {
                          $pass = (new Collection($data['entity']))->first() !== null;
                          if ($pass) {
                              return new EntityContext($request, $data);
                          }
                      }
                      if ($data['entity'] instanceof EntityInterface) {
                          return new EntityContext($request, $data);
                      }
                      if (is_array($data['entity']) && empty($data['entity']['schema'])) {
                          return new EntityContext($request, $data);
                      }
                  }
              ],
              [
                  'type' => 'array',
                  'callable' => function ($request, $data) {
                      if (is_array($data['entity']) && isset($data['entity']['schema'])) {
                          return new ArrayContext($request, $data['entity']);
                      }
                  }
              ],
              [
                  'type' => 'form',
                  'callable' => function ($request, $data) {
                      if ($data['entity'] instanceof Form) {
                          return new FormContext($request, $data);
                      }
                  }
              ],
          ] + $providers;
  
          return new static($providers);
      }
code_tokens: public static function createWithDefaults ( array $ providers = [ ] ) { $ providers = [ [ 'type' => 'orm' , 'callable' => function ( $ request , $ data ) { if ( is_array ( $ data [ 'entity' ] ) || $ data [ 'entity' ] instanceof Traversable ) { $ pass = ( new Collection ( $ data [ 'entity' ] ) ) -> first ( ) !== null ; if ( $ pass ) { return new EntityContext ( $ request , $ data ) ; } } if ( $ data [ 'entity' ] instanceof EntityInterface ) { return new EntityContext ( $ request , $ data ) ; } if ( is_array ( $ data [ 'entity' ] ) && empty ( $ data [ 'entity' ] [ 'schema' ] ) ) { return new EntityContext ( $ request , $ data ) ; } } ] , [ 'type' => 'array' , 'callable' => function ( $ request , $ data ) { if ( is_array ( $ data [ 'entity' ] ) && isset ( $ data [ 'entity' ] [ 'schema' ] ) ) { return new ArrayContext ( $ request , $ data [ 'entity' ] ) ; } } ] , [ 'type' => 'form' , 'callable' => function ( $ request , $ data ) { if ( $ data [ 'entity' ] instanceof Form ) { return new FormContext ( $ request , $ data ) ; } } ] , ] + $ providers ; return new static ( $ providers ) ; }
docstring: Create factory instance with providers "array", "form" and "orm".
  
  @param array $providers Array of provider callables. Each element should
  be of form `['type' => 'a-string', 'callable' => ..]`
  @return \Cake\View\Form\ContextFactory
docstring_tokens: Create factory instance with providers array form and orm .